Thursday, May 08, 2008

Pete left a valuable comment that the hyperlinks were much too subtle in my blog posts. So I changed the link color to orange and its everywhere. It definitely stands out, though I doubt I'll get a design award for it - just clashes a bit. Feel free to suggest a different color if you want!

Thursday, May 08, 2008 7:10:18 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [3]  | 
 Wednesday, May 07, 2008

Entity Data Models have a lot of rules. They are necessary for the integrity of the model, though if you are not familiar with depth of EDMs and *why* these rules exist, many of the mapping rules may seem to make no sense when it comes trying to implement them. This gets hairy when you are mapping stored procedures. Roger Jenning's solution is to create stored procedures that will map properly, rather than suffer wtih the ones that already exist.

The first level of using Stored Procedures is that they work very easily for existing entities that are simple, have no EntityReferences (these involve Foreign Keys) , don't involve inheritance and map directly to a single table in your database.

The next is stored procs that map nicely to entities which don't involve inheritance but if your entities have any relationships, you will probably run into a wall with a delete procedure. Here's why.

Stored Procs become Functions in the Entity Data Model. If you want to use these functions rather than the dynamic SQL that Entity Framework will create, it's an all or nothing scenario. You need to map an Insert, and Update and a Delete. (Read procs doesn't come into play here). There are plenty of blog posts and other resources on how to do this including this tutorial I wrote for the DataDeveloper.net site.

If you have a relationship in your entity, you can map that easily enough to a foreign key parameter in the function mappings and this makes sense with Inserts and Updates. With deletes, generally you only have a primary key (eg ContactID) as the parameter for the stored procedure. But here is where the EDM rules come in to play. A foreign key value that is used in a stored proc, would in most cases map to the EntityKey of a navigation property.

In other words, if you have a stored proc to insert SalesOrders, that procedure will have a parameter for CustomerID. The Order Entity this is mapping to has a relationship to the Customer entity and contains a Customer navigation property. The mapping therefore would link the CustomerID paraemter to Order.Customer.CustomerID.

By doing this, you are involving the association that exists between the Customer entity and the Order entity.

The EDM rule is that if you are involving an association in ONE of the function mappings, you have to use it in ALL o the function mappings.

Therefore a stored proc to delete an order, which only has an OrderID parameter will need also to have a CustomerID parameter because you are required to map SOMETHING to the Customer entity.

This then breaks a possible rule. It means you need to go to the dba and beg them to add this parameter into the stored procedure even though it doesn't get used.

The alternative is to just go in and modify the SSDL to trick it into thinking that that parameter exists which will make the model happy and the database won't care at all. IT doesn't ever really get used.

So if the actual stored proc is

PROCEDURE DeleteOrder

@OrderID int

AS

DELETE from ORDERS WHERE OrderID=@OrderID

and the original function in SSDL is

 <Function Name="DeleteOrder" Aggregate="false" BuiltIn="false" NiladicFunction="false"
            IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
     <Parameter Name="OrderID" Type="int" Mode="In" />
 </Function>

You just need to add a new parameter to the SSDL

 <Function Name="DeleteOrder" Aggregate="false" BuiltIn="false" NiladicFunction="false"
            IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
     <Parameter Name="OrderID" Type="int" Mode="In" />
     <Parameter Name="CustomerID" Type="int" Mode="In" />
 </Function>

This is all fine and good until you need to update the model, because the SSDL will lose all customizations.

I keep my customizations listed in a separate text file so that if I must update the model,  I can replace them.

It's not pretty, but when I don't have a lot of customizations, I will choose this over bugging the dba. Okay, in my world, I'm the DBA (how pathetic is that) but I'm trying to think about enterprise developers and real DBAs.

I started out wanting to write about dealing with stored procs for entities that are inherited, but I guess that will have to come later!

Wednesday, May 07, 2008 1:33:03 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

I was perusing Chris Williams' blog over on GeekswithBlogs.Net. I met Chris many years ago through INETA and in person at an INETA User Group Leader event. Chris ran the user group in Charleston, South Carolina and has since moved to Minnesota where he has survived his first winter with all of his fingers and toes intact. He is a really nice, unique and memorable guy (okay the tat's definitely help him stand out).

While looking at his blog, I saw a post of photos from a funny ad that apparentlyly reminded Chris of D'Arcy Lussier, a a wild and crazy guy (also a GeekswithBlogs blogger) who lives in Winnipeg (where I think you need to be a little wild and crazy to survive), and probably laughs at Chris' mumblings about the cold weather in Minnesota. D'Arcy also is a user group leader and I see him frequently at the DevTeach events in Montreal and look forward to seeing him at DevTeach next week in Toronto where I plan to goad him into a his own Meatloaf imitation. (I didn't realize that the dad in the commercial really is Meatloaf!)

What struck me when I saw the photos and Chris' comments about them was that here are two guys who have a lot in common and are clearly good friends who may never have met if it weren't for INETA and the .NET blogging community. I know it may seem obvious that of course they would find each other, but it's not a given. These resources were only just starting up 6 years ago, so they are relatively new.

It really made me stop and think when I saw that blog post and made me happy and very proud of the community that we have all created.

Wednesday, May 07, 2008 8:10:13 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [3]  | 
 Tuesday, May 06, 2008

And I haven't even had a chance to look at any presentations yet.

Here's what's on my schedule so far.

  • Monday morning - speaker training
  • Monday afternoon - INETA User Group Leader Meeting (yay!)
  • Monday evening - Speaker dinner
  • Tuesday 1-2: Vista Ask the Experts Booth demoing Annotation in Silverlight
  • Wednesday Lunch: Women in IT Panel (yay)
  • Wednesday 2:45: Birds of Feather "Is Entity Framework right for your application?"
  • Wednesday 7pm: Birds of Feather with Steve Smith: "Going Solo"

(and the real reason I'm going)

  • Thursday 10:15 - 11:30 am  Advanced Entity Framework: Take Charge of Object Services
  • Thursday 2:45 - 4:00pm Microsoft .NET Framework 3.5 Data Access Guidance

And then as soon as I finish my session I have to run to the airport to catch a 6:45 flight. (and miss the attendee party, duh)

So this is starting to look like one of the conferences where I don't get to go to sessions. Because all of the rest of the time, I'll need to be in a quiet place practicing my sessions and writing my book!

Tuesday, May 06, 2008 8:54:17 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

Don't pencil it in; ink it in!

May 22nd at Vermont Technical College in Williston from 9am to 4pm.

You may notice that May 22nd is on a THursday. I will put money on the fact that Chris scheduled this so that he can go to Bove's. THe last few times he hit town at the beginning of the week, but Bove's is closed on Sundays and Mondays and I think I heard the sobs all the way down here in Huntington. Thankfully, he discovered The Skinny Pancake down by the water front and is now a fan of that resto, too!

Read more details about the roadshow on Chris' blog!

Tuesday, May 06, 2008 10:25:05 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

It was pointed out to me recently that I've gotten a bit lazy with my coding. I completely blame it on implicitly typed local variables. Read more here...

[A New DevLife Post]

Tuesday, May 06, 2008 10:21:49 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Monday, May 05, 2008

 

spring 002 (Custom)

spring 003 (Custom)

Veggie garden's ready in case I ever get ready. I did already put some lettuce and peas in on the left.
Only super hardy stuff goes in now. We can't do our regular planting (tomatoes etc) until after Memorial Day.
Short growing season in Vermont.

spring 004 (Custom)

Compost is ready and waiting.

spring 005 (Custom)

Lupine are coming up. They are SO hardy.There are hundreds of them in the front field. Looks amazing in early June!

spring 006 (Custom)

The front garden has already got blooms in it and everything else is growing like mad. 

spring 007 (Custom)

And the winner is.... the first tulip opened today.

spring 008 (Custom)

Columbine will be in bloom in another month. They spread on their own so there's a bunch of this.

spring 009

This lilac is making flowers for the first time this year. It's neighbor is still flowerless. Maybe next year.

spring 010

Lots of Lilies. There are also miles of bee balm along this fence as well as berries and lupine and a very hardy delphinium.

spring 011 (Custom)

Is this bucolic enough? I love this ancient Maple tree down by our mailbox.

But best of all, my favorite flowers are STILL here

tasha may 2008

Tasha, now 14 1/2 which is insanely old for a Newfie.

spring 017 (Custom)

And Daisy, the puppy in the house. She's 13 1/2.

Monday, May 05, 2008 1:19:00 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [1]  | 
 Thursday, May 01, 2008

I am thrilled to share this fabulous news ... INETA Noram has a new website. The reason for my jubilation is that for a variety of reasons, INETA has been trying to create a new website for about 4 years, so to see it actually happen is wonderful.

This may have just launched because I hadn't heard anything about it yet or maybe I overlooked it in the last newsletter.

Not only does it have a new look but it has some long awaited features such as an integrated map to find user groups. They have partnered with Component Source so you can buy .NET components right from the site.

I also found the live.ineta.org website that I didn't know about. It has videos (user group YouTube?), a blog that lists things like upcoming code camps and INETA related events and some other resources. 

Thursday, May 01, 2008 10:18:25 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Wednesday, April 30, 2008

This week I had to make a very difficult decision. It will make you laugh, but really, it was hard.

I had to decide if my book will say "Julie Lerman" or "Julia Lerman".

After a LOT of deliberation, I decided to go with my grown up name: Julia Lerman. Which means that any searching on Amazon or whereever for "that book by Julie Lerman" won't find it.

Wednesday, April 30, 2008 8:36:36 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [6]  | 
 Monday, April 28, 2008

EntityStateObjects, to me, are one of the most important little pieces of the EF puzzle. IT is the EntityStateObject that maintains all of the critical info for change tracking. But it's hard to get the big picture of what's going on in there when debugging because all of the important stuff is delivered through methods, not properties.

I wanted so badly to write a debugger visualizer for them but they are not serializable (big pout) so instead, I wrote an extension method that uses a ConditionalAttribute to ensure it doesn't pop up during run time. It's for my book but I didn't want to hold onto it until October when the book should be published.

Since it's not a Debugger Visualiser, I refer to it as a DebugTime visualizer. :-)

Here's what my ObjectStateEntry Visualizer looks like in action:

All of the info is pulled from the ObjectStateEntry. At the top it tells the fully qualified name of the type of the object being inspected as well as the object's EntityState.

Then I use the various methods of the ObjectStateENtry to get the Original Values, the Current Values, the names of the fields and a list of the names of the modified fields.

All of this data I feed into the grid.

If the object is detached, then there is no ObjectStateEntry and the visualizer shows this message when you try to run it:

So enough with the screenshots. Here's the code. And here's a collection of important punctuations for you C# programmers who feel a need to translate

[ ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;  ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;  ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;  ; ; ; ; ; ; ; ; ; ; ; ; ; ;]

 

Imports System.Runtime.CompilerServices
Imports System.Data.Objects

'NOTE: The objects in use here are not serializable so they can't be used
'in debugger visualizers. Instead, you'll need to use them directly, but you can 
'give them a debug attribute so they are only available during debug mode.
<Extension()> _
Public Module Visualizers


  <ConditionalAttribute("DEBUG")> _
  <Extension()> _
  Public Sub VisualizeObjectStateEntry(ByVal eKey As EntityKey, ByVal context As ObjectContext)
    Dim ose As ObjectStateEntry = Nothing
    If Not context.ObjectStateManager.TryGetObjectStateEntry(eKey, ose) Then
      Windows.Forms.MessageBox.Show("Object is not currently being change tracked and no ObjectStateEntry exists.", _
"ObjectStateEntry Visualizer", Windows.Forms.MessageBoxButtons.OK, Windows.Forms.MessageBoxIcon.Warning) Else Dim currentValues = ose.CurrentValues Dim originalValues = ose.OriginalValues Dim valueArray As New ArrayList For i = 0 To currentValues.FieldCount - 1



'you can get from the ObjectStateEntry into the MetaData which actually comes from the EDM
Dim sName = currentValues.DataRecordInfo.FieldMetadata.Item(i).FieldType.Name Dim sCurrVal = currentValues.Item(i) Dim sOrigVal = originalValues.Item(i)
'nothing like a little LINQ query to find some info Dim changedProp = (From prop In ose.GetModifiedProperties Where prop = sName).FirstOrDefault Dim propModified As String propModified = If(changedProp = Nothing, "", "X")

'the funky property naming in this anonymous type is to get around a wierdness with
'LINQ databinding that only occurs in VB - it alphabetizes the fields
valueArray.Add(New With _
{._Index = i.ToString, ._Property = sName, .Current = sCurrVal, _
.Original = sOrigVal, .ValueModified = propModified}) Next Dim frm As New debuggerForm With frm.DataGridView1 .DataSource = valueArray End With frm.lblState.Text = ose.State.ToString frm.lblType.Text = ose.Entity.ToString frm.ShowDialog() End If End Sub End Module

The form has no code, just a few controls:

I created an assembly for my Entity Framework extension methods and just reference the assembly anywhere I want to use it.

Then when I want to use it, I call it against the EntityKey of an Entity Object:

  context = new AWModel.AWModel.AWEntities();
  cust = context.Customers.Where(c => c.CustomerID == 223).First();
  cust.CompanyName = "JULIE COMPANY";
  cust.EntityKey.VisualizeObjectStateEntry(context);

This has been an enormously useful tool for when I have been presenting as well as just working.

Enjoy!

Monday, April 28, 2008 8:07:48 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Sunday, April 27, 2008

Along with a few hundred other DevConnections attendees, I got a sneak peek of the EntityDatasSource control on Monday during Danny Simmons' Entity Framework Architecture session.

 

I think I paid more attention to the control than what Danny was saying because I was desperate to see how it was set up.

 

Before digging in though, I also wanted to note that the UI of the EDM Designer looks really pretty. I noticed that the association lines/connectors looked different; the whole thing was cleaner looking (were the association names gone?) and the Entities have their own little representative icon now. I can't wait to see this in more detail.

 

The EntityDataSource wizard identifies EntityConnections in the config file and offers those to as choices for building the data source from. Once that is selected, the EntityContainer is also identified, offering the list of EntitySets from the container to use for the data source.

 

Like the LINQDatasource, you have the option of selecting all of the properties at once or selecting specific properties which will perform projection. Like the LINQDataSource, if you project properties, then you won't get a full type back and the data will not be updatable.

 

There was a drop down list below the one where you choose which EntitySet you want to work with but I don't recall what it's name was. Danny did not drop it down. All I can think of that might be there (hopeful) is derived types since they don't have their own EntitySet.

 

Although I don't remember seeing it during the session, Danny did say that you can choose to eager load related data in the same way that you can with the Include method. I don't know how this is done or if it will impact updating, but I don't know why it would.

 

Like the LinqDataSource,  the EntityDataSource performs server side paging, and it does client side caching - of current AND original data. The original data is not stored as complete objects, but the minimal data necessary to reconstruct state when it's time to update. Updates happen, like any other data source, one at a time. So you have to pick an item, edit it and update it.

 

 I've got some of my own examples of using series of entities in web apps which are very different from this. My solution, however, is aimed at a different scenario. Where the EntityDataSource is more scalable because of the server side paging and the fact that it is not caching full objects, my solution allows the user to do a bunch of edits then save them all at once. I keep the objects in the client side cache (I know - horrors! - but it's an option for a developer to choose) and a collection of original objects cached on the server, though it's an application cache, not a session cache.

 

Seeing the EntityDataSource has already given me some ideas of taking my solution and making it more scalable without losing the benefit of the bulk editing.

 

I can't wait to get my hands on the new bits!

Sunday, April 27, 2008 8:20:30 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Saturday, April 26, 2008

It's been in there from the start (well at least since VS2003), but I have only recently started taking advantage of the "Format Document" and "Format Selection" functions in Visual Studio to help with the readability of code or xml. Read more...

[A New DevLife Post]

Saturday, April 26, 2008 9:14:09 AM (Eastern Standard Time, UTC-05:00)  #     |  Comments [1]  | 
 Friday, April 25, 2008
I COPIED THIS ENTIRE BLOG POST DIRECTLY FROM GUY BARRETTE'S BLOG and made one little edit! So shoot me! :-)
 

If you're living in Toronto and don't attend DevTeach, [Guy Barrette says he's] gonna beat you up and force you to code in Clipper for the rest of your life.  Seriously, DevTeach has one of the greatest speakers lineup of all the .NET conferences.

Honestly, where can you hear, see, talk to, describe your problems (IT/Dev related or not) and have a beer with these guys/gals?

Scott Bellware Benjamin Day Oren Eini Cathi Gero Barry Gervin The one and only Kate Gregory YAG The Zen of Scott Hanselman Moi Beth[mond] Massi Kevin MacNeish Ted Neward Roy Osherove Rodman Partyboy Palermo Paul [Yes, it's true. I live on a boat] Sherriff Joel Semeniuk Richard Campbell Peter DeBetta Don Kiely of the Alaska Keilys Bill Vaughn Adam Machanic Carl Franklin Rob Windsor Jim Duffy

And that's only half of them!!!

Need more reasons?

Keynote by Scott Hanselman, Microsoft
Scott Hanselman is one of the most prolific, renowned and respected blogger (
http://www.hanselman.com) and podcaster (http://www.hanselminutes.com) about technologies. Scott is a hands-on thinker, a renowned speaker and writer. He has written a few books, most recently with Bill Evjen and Devin Rader on Professional ASP.NET. In July 2007, he joined Microsoft as a Senior Program Manager in the Developer Division. In his new role he'll continue to explore and explain a broad portfolio of technologies, both inside and outside Microsoft. He aims to spread the good word about developing software, most often on the Microsoft stack. Before this he was the Chief Architect at Corillian Corporation, now a part of Checkfree, for 6+ years and before that he was a Principal Consultant at STEP Technology for nearly 7 years.
http://www.devteach.com/keynote.aspx

Silverlight 2.0 workshop
For the first time an independent conference is having a workshop on Building Business Applications with Silverlight 2.0.  Join Rod Paddock and Jim Duffy as they give you a head start down the road to developing business-oriented Rich Internet Applications (RIA) with Microsoft Silverlight 2.0. In case you just crawled out from under a rock, Microsoft Silverlight 2.0 is a cross-browser, cross-platform, and cross-device plug-in positioned to revolutionize the way next generation Rich Internet Applications are developed. Microsoft’s commitment to providing an extensive platform for developers and designers to collaborate on creating the next generation of RIAs is very clear and its name is Silverlight 2.0. In this intensive, full-day workshop, Rod and Jim will share their insight and experience building business applications with Silverlight 2.0 including a review of some of the Internet’s more visible Silverlight web applications. This workshop is happening on Friday May 16 at the Hilton Toronto.
http://www.devteach.com/PostConference.aspx#PreSP

Bonus session: .NET Rock host a panel May 14th at 18:00
This year the bonus session (Wednesday May 14 at 18:00) will be a panel of speakers debating the Future of .NET. Where is .NET going? How will new development influence .NET and be influenced by .NET? Join Carl Franklin and Richard Campbell from .NET Rocks as they moderate a discussion on the future directions of .NET. The panellists include individuals who have strong visions of the future of software development and the role that .NET can play in that future. Attend this session and bring your questions to get some insight into the potential future of .NET! This bonus session is free for everyone. Panelists are: Ted Neward,Oren Eini ,Scott Bellware
http://www.devteach.com/BonusSession.aspx

Party with Palermo, DevTeach Toronto Edition
Jeffrey Palermo (MVP) is hosting Monday May 12th in Toronto is acclaimed "Party with Palermo". This is the official social event  kicking off DevTeach Toronto. The event is not just for the attendees of Toronto it’s  a free event for everyone. It’s a unique chance for the attendees, speakers and locals  to meet and talk with a free beer.   The event will be held at the Menage club  location and you need to RSVP to attend. Get all the details at this link:
http://www.partywithpalermo.com/

Make sure that DevTeach comes back to Toronto.  Register right now for this year's conference.

Friday, April 25, 2008 9:18:28 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Thursday, April 24, 2008

This bit me in the butt ... TWICE!

When using WebDataGen so that you can get a proxy class for an Astoria data service, if you are running under UAC, the output file will NOT get created, however the tool reports that the file was created successfully.

I spent a lot of time trying to find the file or figure out what I was doing wrong.

Then a week later, when it was late at night and I was sick so my brain was a little foggy, I had to create another proxy but totally forgot the pain I had gone through previously. It was an hour before I finally remembered that I had to run the command window as admin.

So word to the wise....and I should probably make a not of this in the forums.

Thursday, April 24, 2008 9:55:09 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

A local columnist went through some archives of the paper he writes for and collected a history of shocking gas prices as they were reported over the years by the paper. It's a fun read.

Just to be clear, I wasn't old enough to drive when gas was 49cents/gallon.

Thursday, April 24, 2008 12:31:36 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [2]  | 
 Wednesday, April 23, 2008

I left DevConnections for the Orlando airport and when I got there had another hour and a half before my flight, so headed to the Red Carpet Club. I walk in and as I go to sit down I see Dr. Neil. As I got closer to where he was sitting, there was Michele Leroux Bustamante and Mark Miller. A half hour later, in comes Tim Huckaby. So we're all here with our laptops open, chatting and dare I say - gossiping. If you call talking about how cute someone's baby is "gossip", then I guess that would be the case.

 

Wednesday, April 23, 2008 5:09:04 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Tuesday, April 22, 2008

I've been in Orlando at DevConnections for the past few days. I've been a little under the weather which has made it a little rough around the edges for me, but I'm surviving. While it was a bit of a challenge to present a full day workshop with a nasty chestcold, this was nothign compared to Kathleen Dollard who gave a Workflow workshop in the room next door with bronchitis. She knew she was sick but didn't know how sick until I dragged her to a clinic that night and discovered she had a high temperature and bronchitis. Poor thing. She's surviving and did talks today and has more tomorrow.

I met a young programmer named Scott Pio at the attendee party tonight who has been writing some great blog posts about being at DevConnections  on http://spoiledtechie.com/ -- the experience as well as the sessions he has attended. It's so fun to meet young developers who are just so ready to burst with their excitement about technology. It's his first conference and I think the first time he's been somewhere where the term "geek" is actually a complement! Definitely check out his blog and especially his posts about DevConnections!

Tuesday, April 22, 2008 8:16:09 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
 Saturday, April 19, 2008

Hip hip hooray.

My only trip so far in 2008 was on USAirways, so I hadn't realized this until just now as I'm stuck in Dulles for 3 hours because  - oh shock! - my flight from Burlington was delayed and I missed my connection by minutes. As we landed, I saw my plane to Orlando sitting at the gate. I hoofed it down the hallway with my backpack on and my carryon in tow (not great fun in Teva's), arrived breathless to learn that it had just left. Now why don't they get the fact that I'm on a connecting flight - one of their own - and just pulling into my gate and just wait another 2 minutes?

Anyway, at least I had the nice surprise of the free wireless to go along with teh carrott sticks and packaged bites of cheese they have for us here in the lounge. Oh, how it makes me miss the Lufthansa and Ai Canada lounges with their real food and (even though I don't take advantage) local beer on tap!

 

Saturday, April 19, 2008 4:49:48 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 

While it's very hard to leave Vermont when we are having incredible weather (70 - 80 degree days with blue and sunny skies!) I am on my way to Orlando, FL for DevConnections.

Once again, there is a full track dedicated to Data Access. I'll kick it off with a full day of Entity Framework tomorrow. Monday is Microsoft day and I'm thrilled that there will be talks by Mike Flasko from the Astoria team and from Danny Simmons and Colin Meek of the Entity Frameowrk team.

On Tuesday and Wednesday we'll have two more full days with topics like from LINQ to SQL, Synch Services, ADO.NET Perfomance, Entity Framework, Data Sets and more. And top noch presenters like Dino Esposito, Don Keily, Kathleen Dollard, Cathi Gero and more!

Look for the Data Access track which is listed in both the Visual Studio and ASP Connections conferences.

I'll also be doing a session on Astoria Web Mashups in the ASP Connections conference. I was bummed that the current Astoria bits don't line up with Silverlight 2.0 so I can't do that demo any more, but instead I have put together a cool little demo combining Astoria with Popfly. As far as I know, it's the only implementation out there. The session is in one of the 60 minute slots so I'll just have to talk fast, par usual.

If you're at Connections, say hi!

Saturday, April 19, 2008 1:40:52 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [1]  | 
 Friday, April 18, 2008

I was experimenting with creating data services from IQueryables. Rather than use the canonical example of creating a set of 3 person objects on the fly and exposing them, I decided to create a service for my application log. (Not something I plan to expose to the web, just a learning tool ;-)).

I created a wrapper class for the System.Diagnostics.EventLogEntry class because I needed to have an ID field that could be read. Thanks to Jonathan Carter's blog post, I knew that there was no property of the real class that would work, so I needed to create my own class with a valid field for a discoverable identity property.

Having done this, I tested my service which worked just fine:

Since I knew there are  a LOT of entries in my application log file (I don't have a sysadmin to do that maintenance for me) I thought it would be smart to filter the entries by adding /LogEntries?$top=10 to the URI. I wasn't sure how Vista would handle that and wasn't shocked to see in the debugger that the filtering was going to be left up to the dataservice:

It's definitely a huge advantage to be able to expose (or interact with) any IQueryable through Astoria, but don't forget that it's the database that has the query processor. In this case, I was returning 23,000 items to my service to be processed.

If I do the same filter to a service that exposed a database via an Entity Data Model, for example Northwind

http://localhost:55176/DataServices/NWDataService.svc/Categories?$top=10

the query is processed by the Entity Frawework and the filter is part of query sent to the database:

SELECT TOP (10)
[Extent1].[CategoryID] AS [CategoryID],
[Extent1].[CategoryName] AS [CategoryName],
[Extent1].[Description] AS [Description],
[Extent1].[Picture] AS [Picture]
FROM [dbo].[Categories] AS [Extent1]
ORDER BY [Extent1].[CategoryID] ASC

Only 10 items are returned for the service to process.

LINQ to SQL will do the same ... i.e. create a filter query that gets sent to the database.

Yes exposing my entire un-maintained application event log is not a real-life scenario and in a real network, I might even use the nice filters that Vista provides for event logs.

But the point is just to pay attention to what you may be asking your service to do.

Friday, April 18, 2008 4:34:50 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [1]  |