LINQ to SQL (fka DLinq): What’s new in Orcas beta2


Orcas beta2 is here for you. This is significantly ahead of beta1 and pretty close to the final feature set of Orcas for most components. The releases are available both as regular installs and as VPC images.  


Now that Orcas beta2 has been released, it is time to look at what’s new there. But first, a general sense of how beta2 shaped up. Beta1 released in spring was mostly productization of the May 2006 LINQ CTP. So those who played with it only a little bit did not see a big change over May 2006 CTP – just API tweaks, more robustness etc.


Beta2 is a different animal. This is the first time we are able to do substantial additional features and reorg of features after wrapping up the core functionality for beta1. So here is what to look for:



  1. Significantly enriched code-gen: Looks for partial methods on DataContext and entity classes that can be extended in your partial class. Examples include


    1. Property setter validation methods (pre/post)

    2. Entity initialization and validation methods

    3. Create/Update/Delete (CUD) override methods (e.g. UpdateCustomer())

  2.  Unification of code gen. Now SqlMetal’s code generator also powers the beautiful LINQ to SQL designer. So you can use either tool to gen your classes and get consistent results.

  3. LinqDataSource for your web apps that modify data but don’t want to include a ton of custom code.

  4. Revamped and rationalized WinForms databinding support (no more ToBindingList() needed)

  5. Tonnes of perf improvements across the board. Rico has already blogged about this a lot. 

  6. Streamlined and enhanced support for detached objects (see Attach() APIs) for multi-tier apps

  7. SQL Server Compact (fka SQL CE) support in LINQ to SQL runtime and SqlMetal (though not in the designer)

  8. Better APIs for getting commands and changed objects (GetChangeSet/GetCommand instead of GetChangeText/GetQueryText)

  9. Inheritance enhancements – a relationship can be added in a derived class and a relationship to a derived class is now supported

  10. Partial trust support – now you can use it in ASP.NET medium trust with the addition of RestrictedMemberAccess permission

  11. Better serialization

  12. 500+ fewer bugs 🙂

  13. Sweet sample – query visualizer is back by popular demand after disappearing in beta1 for a design overhaul.

  14. Lots of improvements in the designer for sproc handling – especially for insert/update/delete. But that is almost a separate topic best handled elsewhere

  15. A sweet mystery feature to give the power of dot to sprocs – more about it in a later post

Now I just have to update the online LINQ to SQL paper by crazily writing stuff over the next few days and provide the gist on my blog.



 


Comments (22)

  1. La Beta 2 de Visual Studio 2008 est arrivée très récemment et avec elle, on retrouve pas mal de petites

  2. Pop Catalin says:

    … guess I never imagined me saying that before but this Linq stuff is the most exciting stuff i’ve seen in years (alongside with Silverlight)

  3. I’ve been working this weekend trying to get my samples for the upcoming Linq In Action book and other…

  4. I’ve been working this weekend trying to get my samples for the upcoming Linq In Action book and other

  5. Here’s an anthology of VS 2008 Beta 2’s changes to LINQ and its domain-specific implementations, which includes a brief description and link to this post: http://oakleafblog.blogspot.com/2007/07/linq-changes-from-orcas-beta-1-to-vs.html

    –rj

  6. Dinesh,

    I believe you were parsing "support" like Attorey General Gozales parses "Did the president tell you … ?" when you said "SQL Server Compact (fka SQL CE) support" in your list.

    A better statement might have been "SQLMetal.exe (not LINQ to SQL Designer) support for SSCE" when you consider your post in post tp the LINQ Project General’s Sql Server CE and linq (Beta 2) thread quoted here: http://oakleafblog.blogspot.com/2007/07/linq-to-sql-to-support-sql-server.html

    –rj

  7. Dinesh.Kulkarni says:

    OK Roger. That definitely got my attention. Just to give you a sense of where I am coming from, as the Program Manager responsible for the LINQ to SQL runtime and SqlMetal, I tend to often have a smaller world view while writing informal things like blogs. Our partner team does the designer so I tend to leave the juicy details (features and missing features) to members of that team.

    But anyway, your basic objection is fair and I have clarified above.

  8. Alexey Lavnikov says:

    SqlMetal generator is little buggy…

    When I want to generate .cs file from my SqlServerCe .sdf password-protected file, it breaks with error "username required" error.

    When I specify username – SqlServerCe provider complains about unknown "username" parameter in connection string.

    The only possible solution is to provide  connection string. However is this case, generated source code is not compilable, because of invalid ProviderAttribute attribute, generated on DataContext class…

    Just FYI

  9. Nagarajan says:

    Hi Dinesh,

    I am excited about LINQ to SQL and exploring it. I like to know that how it can be used project like – WPF smart client application handling over 3500 user. If I use web service for database manipulation then I will lose lot of LINQ to SQL features. I could understand that it is great for Web-based Asp.Net application. But I want to know how to use it on smart client when the users are more. Is there any thing like LINQ to RemoteDB coming the near future?

    Regards,

    Nagarajan.

  10. Dinesh.Kulkarni says:

    Hello Nagarajan,

    I am not sure if you are talking about a 3-tier system where you want to ferry the data from mid-tier to presentation-tier or something else here (2-tier, …). I am not following the term "LINQ to RemoteDB" since the database doesn’t need to be "local" in LINQ to SQL.

    If you are talking about classic 3-tier smart client model, you could serialize the objects from mid-tier through a web service. We are putting together a sample to show how the objects could be roundtripped between tiers.

    Thanks,

    Dinesh

  11. Dinesh.Kulkarni says:

    Alexey,

    We will look into this again. If you have a few cycles and could share more details over email, that would be helpful.

    Thanks,

    Dinesh

  12. Nagarajan says:

    Hello Dinesh,

    Thank you very much for your reply. I am so sorry about my unclear question. My understanding was, for example, If I want to take advantages of features in DataContext (Track changes, SubmitChanges () and etc.), I should use 2-tier system.  I do not know whether I am correct or not and what I asked was LINQ to SQL (by Web service with all the features). If it is possible even 3-tier smart client model, I will be very happy to know. We are having over 250 small and medium web-based (MIS) applications (Intranet) in our organization. I am trying to convert all into a single smart client application, but the number of user for this application may be over 3500. please advice me on how I can use LINQ to SQL for this scenario and point me the samples links.

    Regards,

    Nagarajan

  13. JP says:

    I could not find a way to add custom attributes to the model’s properties in the OR designer in Beta 2.

    Will this be available in the final release?

  14. There are several good new blogs from members of the Microsoft C# team. Nevertheless, the most important

  15. Dinesh.Kulkarni says:

    JP,

    Unfortunately, we were not able to fit that feature (custom attributes) in V1 of designer.

    Thanks,

    Dinesh

  16. Dinesh.Kulkarni says:

    Hello Nagarajan,

    Currently 3-tier, smart client systems are easiest to build with LINQ to SQL if you follow some of standard SOA guidelines and use web services appropriately. If the interaction between presentation and mid-tier is of fine granularity (i.e. task-specific, small amount of data exchanged), then it is quite reasonable to use LINQ to SQL Attach() API on the mid-tier.

    If you have timestamps in your schema, it gets even easier since the update/insert/delete related services don’t have to take original copy of the object for optimistic concurrency. I am working with our documentation team members to get a section of multi-tier applications in the final product documentation.

    HTH

    Dinesh

  17. Christopher Smith says:

    Alexey,

    I rec’d an error like "user is required if password is specified" and ended up putting a null /user:” parameter on the SqlMetal command line:

    SqlMetal test.sdf /user:” password=’test’ /code:test.cs

    Chris