locked
LINQ in Orcas May CTP RRS feed

  • Question

  • Just been trying out LINQ to SQL in the current *March 07* CTP of Orcas - could not find any Feedback forums for LINQ so I'll post my queries here. These all relate to System.Data.LINQ and dbml data class generation.

    1) No support for user defined types?

    I would like to be able to map a database int column directly onto an Enum for example, e.g. change System.Int32 to MyEnum in properties for a .dbml MemberPropery

    2) No auto-generated collection classes?

    Although LINQ to SQL generates the instance classes e.g. Customer it does not seem to generate a class for collections, but instead usese 'long hand' global::System.Data.Linq.Table<Customer> each time. Fine, but this forces the developer to create their own each time and cast any embedded properties -- e.g. I define

    public class Orders : global::System.Data.Linq.Table<Order> {
        public int OverdueCount() { /* user code here */ }
    }

    Then I cannot (with current LINQ) do this directly:

    myCustomer.Orders.OverdueCount

    since myCustomer.Orders property is of type global::System.Data.Linq.Table<Order>

    Is this in LINQ to SQL or planned?

    3) Identity management

    It didn't seem obvious how identity fields are handled when committing to a database. If I have Customer (with CustomerID as int identity) and Order (with foriegn Key CustomerID), and create a new customer and a new order at the same time,

    4) DataObject support?

    In my own data access layer I am currently using with .NET 2.0 I found it really useful to build in DataObject methods for each object and collection so that I didn't have to do this for all the basic (and frequently used) types of updates, e.g. as well as select single object by primary key, update insert and delete, and select collections e.g. Customers (all) and select collections by foreign keys. It might be functionality to add as an option that can be enabled/disabled.

    Hope to hear from the team if they are about - or otherwise a pointer to a feedback site for Orcas (there does not seem to be one at present!

    Saturday, March 24, 2007 12:01 PM