| > Quick question: do you know why it uses methods like db.InsertWithInt32Identity(product) rather than db.InsertWithIdentity<int>(product) or similar? Because it's not that easy with Generics. :) The signature of the method is as follows: public static int InsertWithInt32Identity<T>([NotNull] this IDataContext dataContext, T obj, string tableName = null, string databaseName = null, string schemaName = null) If we tried... public static TIdentity InsertWithIdentity<TInsert,TIdentity>([NotNull] this IDataContext dataContext, TInsert obj, string tableName = null, string databaseName = null, string schemaName = null) You'd actually have to write: db.InsertWithIdentity<MyTableType,int>(myTableItem); which is also potentially confusing if you're trying to glance at the code. But wait, some might ask, Select has two types, how come it doesn't have this problem? public static IEnumerable<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector) But as the signature shows, the return type is based on the expression passed as a parameter, which is why you don't have to do it there. :) Edit: That said, there's facilitation for inserting with granular control over columns.... which is when I stopped waiting for EF to get it's act together. :) |