Friday, June 06, 2008

Matthieu has written a very clever method extension that allows the important eager loading method, Include, to accept a lambda expression (strongly typed) rather than a string for its parameter.

I like this better than my method of ensuring that I type the strings correctly, which is to start entering the parameter without the quotes and let intellisense help me, then add the quotes after the fact.

Here is the actual documentation that covers Include (look under "Query Path" in this topic) if you're not sure what we're talking about.

Friday, June 06, 2008 3:38:11 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

It was already enough that The New Yorker had short stories by Annie Proulx AND Vladimir Nabokov, but reading through the Talk of the Town, there was an essay about the staff of Archaeologist magazine discussing the latest Indiana Jones movie and there was my old friend Ken Feisel, who is the Design Director for that magazine and who I worked with when we were kids a million years ago at Playboy. At the time he was the artistic director for the advertising department and I was in the media research department. I still attribute one of my favorite quotes (I added my own twist to it though) to him. We lost touch after I moved out of NYC in 1991, but have reconnected a few times since.  Since I have always said "I may be a geek, but I"m not a nerd", I got a big laugh when the essay ended with Ken calling his co-workers nerds.

Friday, June 06, 2008 2:34:16 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Tuesday, June 03, 2008

No, not *that* one (the oh-my-god-I-gotta-have-a-baby-before-it's-too-late, clock ...that stopped ticking years ago). My flight to Orlando for TechEd was a 6am flight. The concept of me getting up on time for that, much less even being awake at 6am makes my husband laugh his butt off.

I got to bed last night at 11 and set my alarm for 4am. Well, I changed the alarm *time* to 4am, but apparently never pushed the button to make the alarm go off. And I was exhausted so I slept very soundly. Somehow (and this is not normal for me), I woke up in the middle of the night and in my daze remembered that I had a flight so looked at the clock. It was 4:10!

I don't know how I was so lucky, but thank goodness. Being a bit of a road warrior, I had all of my stuff ready to go and my clothes laid out, so it took me no time at all to get dressed and out the door. And I was sitting in the waiting area at 5:15 with plenty of time to go.

Phew.

Flights are all on time so far so good. Looks like I'll make it easily for my Ask the Expert Session. The location is "Red TLC- Windows Booth", wherever that is!

Website Graffiti?  Drawing and Annotation with Silverlight

Tuesday June 3rd 1:00-2:00                      Julie Lerman – The Data Farm

In this session you will learn the basics of using Silverlight’s InkPresenter to enable users to draw on your websites and annotate images and video. You will also see the how web services can be used in conjunction with Silverlight to provide more advanced features such as handwriting recognition and database persistence.

Tuesday, June 03, 2008 7:35:21 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [2]  | 
 Monday, June 02, 2008

Yesterday at about this time, I was getting ready to head to the airport when I got a phone call resulting in my needing to delay my trip to Florida by a day.

So I paid the $150 "change fee" and rescheduled my flight.

Now I have to leave for the airport in 1/2 hour and went to check in online only to find that, as per united, I may not get to Florida tonight after all.

I already had to cancel everything I was supposed to do today. I wonder what tomorrow's going to be like?

Update: Thankfully there's a 6am flight that I'm now booked on that *should* arrive at 11:15am so I'll only miss one thing in the morning which I'll reschedule. Yes, 6am. That means I get up at 4am. Boy, is my husband laughing at that concept!

Monday, June 02, 2008 3:42:13 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Sunday, June 01, 2008

I'll be doing a fun Ask the Experts session at the Windows Vista booth

Windows Vista at TechEd Developer 2008 “Ask the Experts”

Website Graffiti?  Drawing and Annotation with Silverlight

Tuesday June 3rd 1:00-2:00

If you are curious how to add annotation to your website and want to see a live demo of a cool Silverlight app I wrote that does hand writing recognition, stop by!

Sunday, June 01, 2008 9:52:42 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

The Rhodenendrons will be in full bloom this week and on their way out when I return. If we get a heavy rain, they'll probably be gone.rhodies

The lupine are starting to bloom. This is just a tiny corner of the field (I think about 2 acres) in front of our house where there are literally hundreds.

lupine

The veggie garden needs watching, watering and weeding. I'm a little nervous about deer this year. Every morning I go out and count tomato plants, etc. Plus there's a big hole (on the far right) in between the bush beans and zucchini that I still need to fill; but it will have to wait and therefore some late plantings. This ain't no Bill McCarthy garden, but it's what I can manage.

garden 005

Sunday, June 01, 2008 8:53:20 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [2]  | 
 Saturday, May 31, 2008

In the past few weeks, I have received an number of different VB2008 books for distribution at the VTdotNET User Group. I thought authors/publishers were cutting back on VB books but this is great to see. I wonder why the change, though? Read more here...

[A New DevLife Post]

VB
Saturday, May 31, 2008 8:54:56 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

Come to the Tech·Ed Women in Technology (WIT) luncheon and join in the discussion about challenges that women face today—including how to break through the corporate "glass ceiling"—as well as the tools, initiatives, and organizations that support women who work in the IT industry. Please bring your success stories to share with others.

Date: Wednesday, June 4
Time: 11:45am– 2:00pm

While the Women in IT luncheon is a great way for women who are in IT to get together, meet one another, share stories, opinions and lessons, in the past it has not been a way to exclude men from the lunch table. There's nothing in the description that says "women only".

Having led BOFs on the topic before and attended this luncheon many times, I know there are many men who have questions about women in IT - whether it's how to encourage their own daughters, how to enable women in their companies or an interest in the age old question about why the percentage of women in IT is so low. If you are a man in IT and you are interested in attending the luncheon, c'mon along.

Eileen Brown, Manager for the IT Pro Evangelist team in Microsoft's Developer and Platform Group, is hosting the panel again.

I'll be on the panel this year along with Meryem Tom, a Director at Microsoft and Deborah Arhelger, COO of JNBridge.

See you there!

Saturday, May 31, 2008 6:51:22 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Thursday, May 29, 2008

What will ADO.NET 3.5 look like with the release of VS2008 & .NET 3.5 Service Pack 1? See if this image makes you think: "Oh, right! Hadn't thought of it that way!".

[A New DevLife Post]

Thursday, May 29, 2008 9:56:30 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

In Beta3 of Entity Framework there was a teaser in the properties window for Entities and their properties. We saw properties for Access, Getter and Setter but they were inactive.

With the latest bits (available in the VS2008 SP1 Beta) those properties have come to life. Here's what you'll find and where you'll find them.

Entity has an Access property that can be set to Internal or Public.

entityaccess

Each property (scalar as well as navigation) has a Getter and Setter that can be Public, Private, Protected or Internal.

propertyaccess

EntitySets have a Getter property that can be Public, Private, Protected or Internal. To get to this property, select the EntitySet in the Model Browser.

entitysetaccess

The settings are dependant on each other. For example if you change an Entity to Internal, but its EntitySet is public , you'll get this error:

EntityType 'Customer' has 'Internal' accessibility and EntitySet 'Customer' has a get property with 'Public' accessibility. EntitySet's get property must not have less restrictive access than containing EntityType's access.   

You'll see the impact of these settings as attributes in the model in the generated class. For example, setting the FirstName property's Setter to Internal results in the a:SetterAccess attribute added to the Property definition in CSDL.

<Property Name="FirstName" Type="String" Nullable="false" MaxLength="50" a:SetterAccess="Internal" />

and in the Customer class, the FirstName's Set becomes Friend Set, limiting access to it.

<Global.System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable:=false),  _
    Global.System.Runtime.Serialization.DataMemberAttribute()>  _
   Public Property FirstName() As String
       Get
           Return Me._FirstName
       End Get
       Friend Set
           Me.OnFirstNameChanging(value)
           Me.ReportPropertyChanging("FirstName")
           Me._FirstName = Global.System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false)
           Me.ReportPropertyChanged("FirstName")
           Me.OnFirstNameChanged
       End Set
   End Property

Thursday, May 29, 2008 8:58:28 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Wednesday, May 28, 2008

In the past, there has always been this funny rule about representing Microsoft at TechEd that said "no open toe shoes". Yesterday we finally got the email about our attire and there was nothing about open toe shoes. However, I was not happy to see "khaki or black pants/skirt" only. (And they were clear to note "where appropriate" next to "skirt" heh.) But the color restriction (which I should have expected) was a bummer because I have lost some weight and my khaki and black pants are awfully baggy and my Patagucci khaki's from my pre-.NET days when I had loads of time to exercise are still a little snug and now a little out of fashion ("Expecting a FLOOD, Julie?"). I do have to go to "the big city" (that's Burlington VT, pop. 40,000) on Friday, so perhaps I'll go buy some new pants. But at least I get to wear my Tevas.

Wednesday, May 28, 2008 10:17:13 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [2]  | 

In keeping with the theme of the last few posts (about eSqlBlast written by Zlatko Michailov), Zlatko has just broken his news (a big surprise to me and I am definitely bummed) that he has "decided to take on new challenges unrelated to EDM and Entity Framework. Starting [yesterday] [he]’ll be working on the lower levels of the SQL Server Connectivity stack."

He has promised me that there are others on the team who know EntitySQL as well as he does (it's hard to imagine).

So he's going further down into the plumbing and I'm sure this will still benefit all of us who use SQL SErver in our apps.

But still.... :-(.

Wednesday, May 28, 2008 10:07:28 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Tuesday, May 27, 2008

I meant to mention this in my last blog post (An excerpt from my book about eSqlBlast) which is that with the new Entity Framework bits, the schema files that are generated when you build your EDM project are embedded into the assembly by default. Yet eSqlBlast depends on files that are accesible via the file directory.

What I've been doing is temporarily changing the MetaData Artifact Processing property of the model to Copy to Output Directory, building the project, then copying the newly created files (csdl, msl and ssdl) to a separate folder. Then I can point eSqlBlast to those files and set the model back to Embed in Output Assembly so that the other projects depending on the model can access the schema files.

Tuesday, May 27, 2008 9:01:09 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Monday, May 26, 2008

eSqlBlast – Entity SQL Query Helper
I could not have figured out some of these more complex Entity SQL queries without the help of a tool called eSqlBlast written by Zlatko Michailov (in his free time) who is the Program Manager for Entity SQL. The tool is available on Code Gallery along with a number of other tools for Entity Framework at http://code.msdn.com/adonetefx. With eSqlBlast, you can test queries and receive immediate feedback, whether it is an error message describing a problem with the query, or the results along with the generated SQL for the database. I have used the tool in its early stages and look forward to seeing it evolve.

Monday, May 26, 2008 5:04:07 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

I have been learning a lot about EDM QueryViews lately, though more of what I'm learning (the hard way) is what you can't do with QueryViews.

Most of what you'll find documented about QueryViews is to replace mappings so that your resulting entity is read only. But there are more uses for QueryViews. THe problem is that I"m having a very hard time discovering what those are and therefore it's trial and error (and some help from Srikanth on the EF team who seemed to get stuck with Holiday Weekend forum duty).

It started with an old hope of mine to be able to embed a FullName property directly into the model. I thought I could do this with QueryViews by adding a new property to the Entity called FullName and then using EntitySQL string concatenation syntax to combine Trim(LastName) + ", " + FirstName or at the least Concat(LastName, ",", FirstName).

After working out the various validation errors and then weeding out what causes them (Trim, Contact and +) I have come to the conclusion that you just can't use any functions at all. I could be wrong, but so far that's where I'm at.

In fact it took me a while to realize that this error

The query view specified for 'Contacts' EntitySet's type(s) 'IsTypeOf(BAModel.Contact)' contains an unsupported expression of kind 'Function'.

 

might not be telling me that the Trim function wasn't supported but that no Functions are supported I still can't tell, but expect to get some confirmation one way or another (and it *is* a holiday weekend in the U.S. so I'll be patient).

 

I'm still waiting for confirmation of my conclusion, but after going around in circles for days, I wonder if I've finally hit the nail on the head.

 

I also sent an email to the doc team to please include more details about writing QueryViews.

 

QueryView does support a bunch (but not all ) of the EntitySQL operators. You can do things like write CASE statements, perform UNIONS, test for ISNULL. So you can write some logic into them.

 

It also supports operators that can't be used in Conditional Mapping. WIth Conditional Mapping you can only test for = or IS NULL or IS NOT NULL. By using a QueryView you can add int greater than and less than, BUT  - on what?

 

I thought - ah okay, I'll try a condition on a date field.

SELECT VALUE BAModel.Contact(c.ContactID,c.FirstName,c.LastName,c.Title,c.AddDate,c.ModifiedDate)
FROM dbo.Contact as c
WHERE c.AddDate>="1/1/2007"

 

I was trying to emulate T-SQL here but I need a date, not a string. I thought that without a functino I was hosed again, until I discovered ENtitySQL's Literals and rewrote the query successfully this way.

SELECT VALUE BAModel.Contact(c.ContactID,c.FirstName,c.LastName,c.Title,c.AddDate,c.ModifiedDate)
FROM dbo.Contact as c
WHERE c.AddDate>= DATETIME'2007-01-1 00:00'

So this gives me two benefits over Conditional Mapping. Not just the greater than operator, but testing against literals. Conditional mappings with "=" can only be used with strings and integers as strings (which therefore also covers booleans). However I haven't pushed the envelope on those, so maybe there's a way after all to use a Date in a literal as well.

 

At the same time, I'm still working out when I would use a Defining Query over a QueryView. One obvious scenario would be when I can't even express the query with a QueryView.

 

With a DefiningQuery, you can write native queries. Above, I'm close to doing that anyway, since this EntitySQL is written against the store layer not against the CSDL layer. So I can just back down one step further and write T-SQL queries inside the model which will return (read only, but updatable via function mappings) entities for me.

 

Not to say that QueryView is as limited as I'm discovering. We just need more code samples of when to use them besides the scenario of creating a read-only entity.

Monday, May 26, 2008 1:20:31 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

Well, not snakeS (pl.), just snake. I'm convinced that every time I see a snake around here, it's just the same one.

So THE snake reappeared a few days ago in an interesting place.

We have something called a Doggie Dooley buried in our yard.

I went to make a "deposit" in it a few days ago, opened the lid, and much to my surprise, there was a snake curled up on top of the contents. And this Dooley was nearly full.

Now I'll leave it to you to find out what a Doggie Dooley would be filled with and then you might understand why I found this a little surprising. I guess I have a lot to learn about snakes.

I did amuse myself for the rest of the day with a little song I made up dedicated to this snake that any five year old would have been proud of. But I'll keep that to myself.

 

Monday, May 26, 2008 9:46:28 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [7]  | 
 Sunday, May 25, 2008

I took a much needed break (mental and physical) from sitting in front of my computer fighting with a chapter that has been a bit of a challenge for me, and cajoled my husband into taking me for a walk. It's finally a beautiful day, about 70 degrees (F), sunny, light breeze. We have trails quite nearby our house that go up to the Long Trail, so went over to the one on the next road and hiked up to the shelter that is a stopping point along the trail, had a snack and hiked back down. It's definitely the most bang for the buck we can get when we can't spend a lot of time playing.

I brought my camera hoping that there would still be some spring flowers and boy were there a lot. I think because it's been a cold spring, things are a bit delayed.

spring hike 037 spring hike 038

spring hike 042 spring hike 043

spring hike 046 spring hike 044

 spring hike 048 spring hike 039

My neighbor said she saw a big patch of LadySlippers along this path. Didn't see too many but looks like someone picked one from here. spring hike 050 

spring hike 051 spring hike 054

My hubby at his finest. ;-)
spring hike 055

Sunday, May 25, 2008 4:45:28 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [2]  | 
 Saturday, May 24, 2008

It's always funny to google for a solution to a problem and find your own blog post pop up with the answer.

I had to use an Entity SQL JOIN query today and I just went back to Chapter 5 to get a reminder of how to construct them. It's not the first time I've taken advantage of what is currently my own personal resource.

Saturday, May 24, 2008 9:16:17 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

Boy it's feeling like it. So many nuances when you start looking at inheritance, complex types, query view, definiing queries , many-to-many mappings and then there are stored procedures. I'm wondering if I should just skip all of that in my book and plan to write a book on mapping and another one on stored procedures?

Okay okay, going back under my rock to keep at it...

:-)

Saturday, May 24, 2008 3:39:03 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Friday, May 23, 2008

This isn't even new news, but it is somewhat new to me! I met Damien at an SDR back in October and had fun sitting with him before I headed to the airport as he advised me that I should probably just get off the fence and move to C# finally. The discussion was mostly around the fact that I won't code on the fly in C# when I do presentations because it's not my natural coding language and I know I"ll do something wrong like use parens in an array and not be able to see why the thing won't compile. He suggested if I was always coding in C# instead of mostly in VB and sometimes in C#, this wouldn't be a problem.

I think it was the first time I heard someone make this argument in an attempt to truly be helpful and serious, not desecrating VB or laughing as they talked; therefore it left me with a great impression of him.

So I was very happy to hear that he took at  job with Microsoft recently and is working on the LINQ to SQL team. He's a really bright young guy. They actually snagged a few of these guys from the SDR. Jonathan Carter was there and became a new hire shortly after.

But to me what is most significant about this is knowing that the LINQ to SQL team is hiring developers. That says to me that they are continuing to work on LINQ to SQL. I get asked about this a lot when I present. I see  questions in listservs and on blogs - if LINQ to SQL is done and Microsoft is going to make everyone who has fallen in love with LINQ to SQL use Entity Framework instead - even if they don't want to. Even Roger Jennings  questioned this in a deeply analytical blog post. (I'm starting to wonder if Roger moonlights as a trial lawyer. ;-))

I have even seen suggestions that LINQ to SQL was intentionally cobbled and done so for political, not technical reasons. I dunno, maybe I'm just too naive; but I find that hard to believe. OTOH, I have worked for myself for nearly 20 years, so I am a little out of touch (and very happily, at that!) when it comes to corporate politics.

But I really don't believe that this is going to happen. I do believe that LINQ to SQL will evolve and, like datasets, remain a completely viable choice for data access in .NET. I can't say why it didn't get a lot of attention for SP1, but comparing it to the fact that Entity Framework has been developed out of band and therefore introduced a lot of new stuff between Beta3 and the RTM version that will be part of SP1 is comparing apples to oranges.

So knowing that they are getting fresh blood (and I don't mean warm bodies) in the form of developers on the LINQ to SQL team is, to me, an indication that the product will continue to evolve.

And of course, thanks to my memory of that conversation last fall, I have already suggested to Danny Simmons that he task Damien with writing some VB samples! Hee hee.

Friday, May 23, 2008 8:33:09 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [2]  |