Chat Topic: C# LINQ Chat
Date: Monday, May 21, 2007
Unique Attendees: 51
Questions Answered: 29



Charlie Calvert MSFT (Moderator):
The chat will begin in about 5 minutes.

Charlie Calvert MSFT (Moderator):
Welcome to C# LINQ to SQL Chat!

Charlie Calvert MSFT (Moderator):
My name is Charlie Calvert, and I'm the Community PM for the C# Team.

Keith Farmer [MSFT] (Expert):
I'm Keith Farmer, dev on the LINQ to SQL team.

Tom Meschter MSFT (Expert):
Hi, I'm Tom Meschter. I'm a dev working on C# IDE features including IntelliSense (completion lists, Quick Info, etc.) and extensibility.

Xun Sun (Expert):
I'm Xun Sun, Test on the LINQ to SQL team.

Charlie Calvert MSFT (Moderator):
We have lots of experts here today ready to talk to you about LINQ to SQL. Just go ahead and start asking any questions about LINQ to SQL, the LINQ syntax or related matters that might be on your mind.

Tiki Wan (Expert):
I'm Tiki Wan, Test on the LINQ to SQL team.

Jomo Fisher MSFT (Expert):
I'm a developer on the LINQ to SQL team

Kathy Lu [MSFT] (Expert):
Hello, I'm Kathy Lu, Test on LINQ to SQL team.

Dinesh Kulkarni[MS] (Expert):
Hello, my name is Dinesh. I am a program manager in the C# team working on the LINQ project in general and LINQ to SQL component in particular.

My soon to be updated blog :-) is at http://blogs.msdn.com/Dinesh.Kulkarni/

Charlie Calvert MSFT (Moderator):
We ask that you keep your questions and comments on topic. We are focused on C# and LINQ today. Please limit your questions to those topics, or one's that are closely related to those topics. Thanks once again for joining us.

Dinesh Kulkarni[MS] (Expert):
Q: hello guys, I'm really impressed by LINQ, but because it's new, I'm not sure I could imagine how to use it in wider application. do you plan to create ( or is it already created) some more complex samples?
A: Yes. We are working on richer samples. In addition, we are also working with the Patterns and Practices group to codify some common patterns.

Dinesh Kulkarni[MS] (Expert):
Q: If I change a table, how do I update it in the Link to SQL designer?
A: Currently, you will need to update it manually. E.g. by deleting it from the designer surface, saving and doing a drag-drop again. The feature for synching with schema changes did not make it in V1 :-(

Tiki Wan (Expert):
Q: Hi! Currently, LINQ supports databases where the schemas are fixed.  Do you plan to add support for situations where the database schema is not known at design time? e.g. where our end users have the capability to customize their databases?
A: Currently, LINQ to SQL support external mapping. You can load different external mapping in runtime.

Dinesh Kulkarni[MS] (Expert):
Q: I believe my final destination will be LINQ to Entities, as I have objects that are split between multiple tables.  Is there much reason to attempt to architect my application using LINQ to SQL as a sort of "stop gap", or should I wait for Entities?
A: You could consider LINQ to SQL as a starting point to try out LINQ in Orcas against relational data or wait for the Entity Framework for complex mappings. It is hard to give a "one size fits all" advice on this topic.

Charlie Calvert MSFT (Moderator):
We need more questions. If you have any type of question related to LINQ that is lingering in your mind, please don't be shy. We have experts here who can answer both beginning level questions and advanced level questions. Any type of question that is on topic is fair game for this kind of chat. Thanks!

Jomo Fisher MSFT (Expert):

Q: What is the concurrency model for LINQ to SQL?
zz, LINQ to SQL uses optimistic concurrency by default. You'll get an exception if there's a conflict. You can handle the exception to resolve the conflict.

Kathy Lu [MSFT] (Expert):
Q:
Does LINQ to SQL support databases engines other than MSSQL?  If not, is there any possibility of Oracle or MySQL support in the future?
A: Currently, LINQ to SQL supports MSSQL and there is no support for Oracle and MySQL. 

Charlie Calvert MSFT (Moderator):
Some folks are asking questions in the Guest Chat area. Be sure to click the "Ask the Experts" button so that your question will appear in the "official list of questions" where our experts can easily pick it up! Thanks. We want to answer all of these questions but it helps if you ask the right way. Thanks.

Dinesh Kulkarni[MS] (Expert):
Q:
@tom: could you comment on any difficulties you had or are having implementing IntelliSense for the new LINQ language features?
A: You can change the external mapping separately from the object model. However, the specific scenario you mention has some issues - if you add one or more fields and corresponding properties, chances are that you want to use them. In that case, you need to recompile your .cs/.vb file. So at that point, it doesn't really matter whether you use ext mapping or attributes.

 

However, if you are making a mapping-only change that doesn't affect code (e.g. responding to renaming of a column or just changing the optimistic concurrency options), then external mapping adds more value beyond attribute-based mapping.

Jomo Fisher MSFT (Expert):
Q: Let me clarify: I am talking about our end users changing the schema. Do you guys plan to add run-time mapping in the future? Sometimes the schema is not known at design time.
A: We support runtime mapping of types through DataContext.GetTable(), but the types need to be compiled.

Tiki Wan (Expert):
Q: Hi Tiki, does this external mapping support mean that if I do not have the schema available at design time, there is a way to make LINQ work at runtime on that database?
A: Yes.

Dinesh Kulkarni[MS] (Expert):
Q: Is there any plan to be able to build a class and have that class generate the database schema? Then when changes to the class are made, table alters are automatically made?
A: The basic Class -> DB capability is available as DataContext.CreateDatabase() method. However, it does not cover any "alter table" scenarios. Such an incremental schema versioning is not planned for V1.

Dinesh Kulkarni[MS] (Expert):
Q: "Currently, LINQ to SQL support external mapping. You can load different external mapping in runtime." What if the user adds a few new fields? Would it be possible to recompile the mapping?
A: You can change the external mapping separately from the object model. However, the specific scenario you mention has some issues - if you add one or more fields and corresponding properties, chances are that you want to use them. In that case, you need to recompile your .cs/.vb file. So at that point, it doesn't really matter whether you use ext mapping or attributes.

 

However, if you are making a mapping-only change that doesn't affect code (e.g. responding to renaming of a column or just changing the optimistic concurrency options), then external mapping adds more value beyond attribute-based mapping.

Jomo Fisher MSFT (Expert):
Q: Can I associate a field in a table with an enum (type is a tinyint) in the LINQ to SQL designer? It doesn't look to me like you can.
A: Stefan, I think this should be possible. You would need to define the enum outside of the designer though.

Tiki Wan (Expert):
Q: Hi Tiki, does this external mapping support mean that if I do not have the schema available at design time, there is a way to make LINQ work at runtime on that database?
A: You could load a different external mapping on runtime. During runtime, you could construct your data context with a different external mapping file. 

Tom Meschter MSFT (Expert):
Q: @tom: could you comment on any difficulties you had or are having implementing IntelliSense for the new LINQ language features?
A: Certainly! Getting completion lists to work "as expected" in object and collection initializers, lambda expressions, and most of all in query expressions has been a major challenge. Since variables declared in the "from", "join", and "let" clauses of query expressions do not have to declare their types, we've had to greatly increase our ability to do "on the fly" type analysis so we can show proper Quick Info for these items, and show their members properly in Completion Lists. The upside to this work is that IntelliSense has been improved across *all* language features. That's a very high level answer for you; please feel free to ask if there's a particular area you would like to know more about.

Charlie Calvert MSFT (Moderator):
We need more questions. Any thoughts you might have about LINQ to SQL would be welcome. If you are thinking about moving to LINQ to SQL, if you are not sure why you should use LINQ to SQL, if you have questions about IQueryable or Expression Trees, this is the place to step up and say what is on your mind. We welcome your questions.

Keith Farmer [MSFT] (Expert):
Q: Have any of you been working on LINQ implementations for other data sources?  Have you encountered difficulties implementing IQueryable that we might be able to help with, or are things progressing well?

Dinesh Kulkarni[MS] (Expert):
Q: (Forgot to ask experts):  I know stored procedures are supported, but is there a way to have the IDE automatically generate CRUD sps and store them in the db? (Using the same SQL statements that it would use dynamically?)
A: No currently, we do not generate T-SQL for creating sprocs. Why would you want sps if the SQL is the same as dynamic SQL (i.e. no security related changes)? The performance on the two would be the same starting SQL2k (some earlier versions had some perf gains with sprocs).



Kathy Lu[MSFT] (Expert):
Q: (Forgot to ask experts):  I know stored procedures are supported, but is there a way to have the IDE automatically generate CRUD sps and store them in the db? (Using the same SQL statements that it would use dynamically?)
A: No, there's no way to create SPs and save it as part of an already existing DB. 

Tom Meschter MSFT (Expert):
Q: @tom: could you comment on any difficulties you had or are having implementing IntelliSense for the new LINQ language features?
A: Also, implementing support for extension methods (which are a big part of the LINQ story) has been quite a challenge since their scoping is quite unlike anything we've had in the language up to this point. Determining the correct set of extension methods available for a particular type at a particular location in the code is difficult, but getting it right has been a very high priority for me and the other developers working on IntelliSense.

Jomo Fisher MSFT (Expert):
Q: >>Q: Can I associate a field in a table with an enum in the Link to SQL designer? A: You would need to define the enum outside of the designer.<<  It doesn't appear on the list of types in the UI (although I can change the .cs to use it in WPF, not in ...
A: Dinesh is telling me this wasn't supported in Beta1, I'm trying now to verify that it will work in an upcoming version.

Dinesh Kulkarni[MS] (Expert):
Q: How can I set up a table to act as an abstract base class (derive) rather than association in LINQ?
A: I am not sure I understand your question. Could you please give an example of what you are trying to do? LINQ to SQL run-time already supports abstract base class.

Charlie Calvert MSFT (Moderator):
We are about half way through the chat now. We still have plenty of experts with us ready to answer your questions. Please chime in with your questions.

Dinesh Kulkarni[MS] (Expert):
Q: As a general question (I'm not looking for anything in particular), is beta 1 pretty much feature complete or is there a raft of new things coming in beta 2?
A: There are plenty of cool and useful features in beta2 that are not there in beta1 of LINQ to SQL. Enhanced code gen using C# partial methods, better sproc support, more perf optimizations etc. In fact beta2 is the first time we will have significant new features since May 2006 LINQ CTP. Beta1 was mostly cleanup, product related issues, and integration of features in May 2006 LINQ CTP for LINQ to SQL.

Kathy Lu[MSFT] (Expert):
Q: As a general question (I'm not looking for anything in particular), is beta 1 pretty much feature complete or is there a raft of new things coming in beta 2?
A: There are many new features coming in Beta 2.   SQLCE support, CRUD Overrides, Support for Advanced N-tiered architecture to name a few.. 

Jomo Fisher MSFT (Expert):
Q: >>Q: Can I associate a field in a table with an enum in the Link to SQL designer? A: You would need to define the enum outside of the designer.<<  It doiesn't appear on the list of types in the UI (although I can change the .cs to use it in WPF, not in ...
A: Stephan, I have confirmed that this works on a recent internal version. The enum type doesn't appear in the type list but I can just type it in to the list myself and it works. I haven't confirmed this doesn't work in Beta1.

Tom Meschter MSFT (Expert):
Q: @tom: Has this better on-the-fly analysis improved IntelliSense in other areas that aren't necessarily related to LINQ?
A: Indeed. In general, we do a better job of determining the types of arbitrary expressions than we did in VS2005. As a small example, if you type "(1 + 1). " in 2005, we would not show you a completion list with the members of "int", as you might expect. This now works in Orcas. Also, if you hover over "var" in Orcas, Quick Info will show you the real type. This was something we couldn't have done (at least not as well) in 2005.

Keith Farmer [MSFT] (Expert):
Q: table "fruit" contains an id, table "apple" has a foreign key pointing to "fruit"; currently dragging the two tables into LINQ causes it to act as an association ("apple" has a "fruit" but I want apple to derive from fruit ("apple" is a "fruit")
A: LINQ to SQL's inheritance support is limited to single-table (ie, a discriminator column determines the type of the returned row).  You may want to use LINQ to Entities for your particular schema.

Jomo Fisher MSFT (Expert):
Q: Enums: In Beta1 you can't type it in to the list.
A: Ok, thanks for confirming. Support should be arriving in a future Beta or CTP.

Tiki Wan (Expert):
Q: table "fruit" contains an id, table "apple" has a foreign key pointing to "fruit"; currently dragging the two tables into LINQ causes it to act as an association ("apple" has a "fruit" but I want apple to derive from fruit ("apple" is a "fruit")
A: You can also create a view to combine fruit and apple tables into one single table. So, you could use a discriminator column determines the type of the returned row.

Keith Farmer [MSFT] (Expert):
Q: Can inherited members reside in different data stores?  So A is in Database A and B : A ( the B part resides in Database B ) ??
A: See the answer regarding single-table inheritance. 

Charlie Calvert MSFT (Moderator):
Q: When is beta 2 due?
A: The official time line for Beta 2 states that it will come out sometime this summer.

Dinesh Kulkarni[MS] (Expert):
Q: It was mentioned that there is currently no LINQ to SQL support for Oracle or MySQL databases.  Will it be possible for developers to implement their own SqlProvider implementations for these database engines?
A: We don't really have a provider model or provider writers' SDK in this release (Orcas). So it is possibly to build a LINQ provider similar to LINQ to SQL; but unfortunately, in this release, we won't be able to offer much to make that as simple as we would like.

Charlie Calvert MSFT (Moderator):
There are about 15 minutes left in the chat. This is the time to come out with any more questions that might be lingering in the back of your mind. We definitely have time to answer more questions about C# and LINQ or related topics.

Dinesh Kulkarni[MS] (Expert):
Q: Where can I find a list of current features and features to be added in the future?
A: The current features are documented (not as a list but in more details) in the following min-LINQ to SQL book: http://msdn2.microsoft.com/en-us/library/bb308961.aspx

There is currently no published list of new beta2 features. Something to keep in mind for me and others on the team for a blog-post perhaps. We are just busy with beta2 work so hopefully we can get it to you soon. :)

Dinesh Kulkarni[MS] (Expert):
Q: Are any of you guys working on good LINQ books, or can you recommend something good?
A: We intend to update this book-like doc: http://msdn2.microsoft.com/en-us/library/bb308961.aspx that I first started working on with my colleagues for PDC 2005.

In particular, it is on my to-do list. It is not clear if it will be published in a different form other than a free download.

There are plenty of ext authors writing LINQ books with significant LINQ to SQL contents. My colleague Keith just mentioned four that came up in his web search.

Dinesh Kulkarni[MS] (Expert):
Q: >>Enums: In Beta1 you can't type it in to the list.<< Do I get IntelliSense in that list (when I type)?
A: No. There is no IntelliSense for the "type in" option.

Charlie Calvert MSFT (Moderator):
About 5 minutes left in the chat. Time to chime in with your final questions!

Charlie Calvert MSFT (Moderator):
Q: How do I decode an encrypted folder that I saved?  And then, when I save in the future, I do not want this encrypted - just normal English.
A: I don't think anyone here is an expert on this subject. You might take a look at this link: http://support.microsoft.com/kb/223316. The have a section in that KB article entitled "Decrypting a Folder" that might help.

Dinesh Kulkarni[MS] (Expert):
Q: Is there more overhead in using XLINQ for Xml that is not part of the tried and true XmlDocument? Or is it faster and more efficient?
A: In general, XLINQ is more space efficient than most DOM implementations. It is hard to answer a perf question categorically without more scenario specifics though.

Charlie Calvert MSFT (Moderator):
Q: >>The enum type doesn't appear in the type list but I can just type it in<< I'll lose this everytime I have to delete my table when it changes, won't I?
A: Stephan, we might have to take this one off line. If you want you can write me and I can see if we can get an answer for you.

Tom Meschter MSFT (Expert):
Q: When using LINQ can the queries ever go into la-la land like a bad Regex Pattern can do to the regex parser?
A: In terms of parsing a query? Not in any way that we're aware of. If you run into anything like that in the CTPs/Betas, please report it right away.

Charlie Calvert MSFT (Moderator):
Thank you very much for joining the C# LINQ to SQL chat! We appreciate your questions and look forward to seeing you again next time. You can check my blog for a transcript of this session: http://blogs.msdn.com/charlie/.

Tom Meschter MSFT (Expert):
Q: @Thanks All!
A: You're welcome!

kick it on DotNetKicks.com