Monthly Archives: February 2008

What’s happening with LINQ to SQL now that it’s been released?

If you’ve been wondering, and many of us have, Faisal Mohamood, LINQ to SQL Program Manager, gives us a hint in this blog post: Coming soon to LINQ to SQL. It’s hard to tell if he’s talking about things coming in VS2008 SP1 or if we will have to wait much longer.

Update: Charlie Calvert’s blog indiciates that these are for next release. But that doesn’t quite clear it up. I’ll just pretend that I believe this means, literally the next time something is released, which translates to SP1.

Entity Framework at TechEd

I found out recently that I will be giving not one, but two sessions related to Entity Framework at TechEd 2008 US Developer.

Advanced Entity Framework: Entity Data Model in the Enterprise

and

.NET 3.5 Data Access Guidance

I’m sure there will be plenty of other ADO.NET/EF/Data Services sessions there as well.

Since we’ll be nearing the end of “the first half of 2008” which is the period of time in which E.F. is supposed to be released, this could end up being E.F.s coming out party. But, it’s only early June, and there will be 3 more weeks in the first half of 2008 after that, so it’s hard to call it at the moment.

Danny Simmons on “Context Lifetimes — Dispose or Reuse?”

People are more willing to believe guidance from someone at Microsoft than someone outside of Microsoft, therefore I’m happy that Danny has written a blog post on a topic he has answered a few times in the forums and I have pointed to previously as “evidence” in my own blog posts.

This blog post addresses the question about how long to keep an objectcontext around. Danny reiterates what he has advised in the forums:

Standard cases:

Websites/Web services – shortest lifetime as possible. Create the context, do query/savechanges, kill the context

Client apps (winforms, wpf, console) – it’s okay to leave the context hanging around. IT was designed for that purpose and will make change tracking and updates to the db a lot easier.

Edge cases:

Huge amounts of data to deal with for updates? Handle them in batches. You might want t take a look at the experiments with updating that Alex James has been writing about (see below for links) for a different look at updates.

Client app with data that you would like to cache combined with data that changes: for example, a list of product categories that doesn’t change much as well as order data that changes frequently. I’ve seen the back and forth discussions of this scenario in the forums. Danny recommends using a single context and how to manage that data within that context.

Read all the details here

Alex James blog post series:

  • Rolling your own SQL Update on top of the Entity Framework – Part 4
  • Rolling your own SQL Update on-top of the Entity Framework – Part 3
  • Rolling your own SQL Update on top of the Entity Framework – Part 2
  • Rolling your own SQL Update on-top of the Entity Framework – Part 1
  • MIX08 Sneak Preview: The MVC tools

    Remember how I recommended subscribing to the WebDevTools blog only a few weeks ago? (grin) Well, it continues to pay off!

    Vishal Joshi has written a blog post about the tools for building MVC that will be previewed at MIX. Usually these goodies are shown first at MIX and then in blog posts.

    Tooling Features Overview of ASP.NET MVC Framework for MIX 2008 shows some of the improvements made to the tools for creating MVC apps and more handily creating unit tests for them.

     

    ADO.NET Data Services + PopFly

    A while back, Pablo Castro had created a PopFly block from an Astoria service. It no longer seems to work, presumably because he created it with the preview bits, not the CTP bits.

    I want to use a Popfly example in my upcoming DevConnections session Web Mashups with ADO.NET Data Services , so I decided to try to create one myself. It took a little hairpulling, but I’ve succeeded.

    I created an ADO.NET DataService with an EDM as the source data. I used Northwind for my data model.

    In order to create and test the block in Visual Studio 2008, I downloaded the Popfly Explorer plugin and built up a Northwind class that has a single exposed function of getCustomers.

    SInce I’m just starting out with this, my popfly block merely returns some read-only data from the service. It’s not interactive (i.e. you can’t drill in to anything in the block) because that will require me needing to learn how to build a display block as well. So for the time being, it’s just spitting out an array of objects that contain only two properties: CompanyName and Details which is just some aggregated data about the customer orders.

    I had some problems with the SDK and had to work around them.

    1) There is a getXML function but it wasn’t returning anything. So I used the getText function instead then manually created an XML doc from the results.

        var root = “http://www.thedatafarm.com/dataservices/northwind/awdataservice.svc/Customers?$expand=Orders”;
        var result = environment.getText(root);
        var doc=new ActiveXObject(“Msxml2.DOMDocument.3.0”);
        doc.loadXML(result);

    2) Popfly’s handling of javascript is not exactly the same as the results I was getting when testing in VS2008. Specifically with variable declarations. Declaring a variable and giving it a value in one line of code resulted in incorrect data when I ran the test in Popfly (even though it was perfectly fine during debugging in VS2008). THerefore I had to break up those code lines. It took me quite a lot of testing before I thought of this (I thought it had something to do with the use of toString and wasted some time going down that road).

    var orderCount;orderCount=orders.length;var orderTotal;orderTotal = 0;

    I selected an existing block for displaying my data, the NewsReader, and wired it up to my block.

    The last step was to define what will be displayed. There’s a simple view:

     

    but that only gets me to the objects, not the properties. So I had to go into the “advanced” view and modify the script, by adding “.CompanyName” and “.Details”  where the array was being called.

     var result = newsReader.addNewsItem(data[“thedatafarmAstoriaNorthwind”][i].CompanyName,
    “2/15/2008”, data[“thedatafarmAstoriaNorthwind”][i].Details,
    “http://www.thedatafarm.com”);

    et voila!

    So this was just a “can I even make it work?” test and now that I have gotten past it (and spent all of those extra hours dealing with the above mentioned anomalies, so you don’t have to now…hopefully the next iteration of this beta SDK will make things a little easier), I’ll continue exploring.

    I have shared it and the name is “thedatafarmAstoriaNorthwind”. I tagged it as “Data” so it should be under there.

    What ever happened to Project Jasper?

    An ADO.NET team project called Jasper was announced and demo’d at last year’s MIX conference. I played with the available bits and wrote an article about it for O’Reilly: Build Dynamic Database Applications in .NET with Project Codename “Jasper”

    Not much has been heard about Jasper since then, while the other incubator project that was announced at MIX has evolved into ADO.NET Data Services.

    Jasper, in the meantime is stagnant and hasn’t even been updated so that it can be used in VS2008.

    In the Jasper forum, someone finally just came out with it and asked: “Is Jasper Dead?”

    Andy Conrad replies:

    We have no news about Project Jasper because we really have nothing interesting to report.

    The project team wants to port the code base/ functionality over to the DLR, hence we are waiting for that to mature before doing so.  We are also thinking of doing a DLR based Astoria client with Jasper like functionality, but need to get Astoria V1 done.

    As I have posted before, if folks want us to update the Jasper CTP for VS 2008 RTM or have any ideas of what direction we should go in, they should post to the newsgroup or send email. 

    So it sounds like there was not enough interest expressed in the project and therefore it is just shelved for now.

    As Holger Froebe suggests in reply to Andy’s answer, if there was a VS2008 version for people to play with, more people would very likely be playing with it and help drive interest.

    From the forums – what’s in the near future for Entity Framework and tools

    Some of the best info about Entity Framework is buried in the forums.

    I wanted to surface a few important things.

    1) From Danny Simmons on January 28th responding to a question about RTM, while Danny is forced to repeat yet again “first half of 2008” he drops some great info about another build to play with before then:

    “What I can tell you, though, is that there will be another beta/ctp before the final release.  Sadly I don’t have a firm date for that yet either.  We’ll let you know just as soon as we can.”

    2) From Noam Ben-Ami, who is the PM for the Tools, in response to a question about creating an EDM and then generating database objects from that:

    “Despite our best efforts, this feature does not look like it will make the first release of the designer. We are working on this for a future release. In the meantime, we are looking for a way to release some sample code that will demonstrate this functionality and which you’ll be able to modify for your own needs/database platform.”

    I mentioned the second point in my upcoming DotNetRocks interview, though I was having a hard time remembering which feature I had read this news about. My memory, it turns out, did serve me right although I was very hesitant for fear of misspeaking.

    It would be great if this information were more readily available (poke poke), which is why I’m blogging it! 🙂