none
Tutorial suggestion RRS feed

  • Question

  • Could anyone tell me what to search for to learn how to do slightly more complicated queries and databinding with ADO.NET Entity Framework?

    I understand basic CRUD, but what if I want a custom query that results in some goopy data?  Such as return all the zip codes of customers with large purchases and have ordered more than three times... list the results nested by:

    zip (grouped), Customer Name (grouped), purchases (listed).

    Could someone give me the search terms to just get me started?

    Tuesday, March 5, 2013 8:18 PM

Answers

All replies

  • Hi Guntheria;

    Most of the tutorials found on the net show basic queries. I found using LinqPad as a learning tool was very helpful and best of all it's free. It comes with a collection of queries that actually are excerpts from the authors book C# 5.0 In A Nutshell by Joseph Albahari and others have written queries which can be downloaded through the application. Try it out you may like it

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Tuesday, March 5, 2013 9:30 PM
  • Wow! thanks for the tip.

    I guess what I'm trying to ask is: what if I want to return a query that doesn't correspond to a database table, but rather a mixture of a few tables. Do I need to define my own data entity? 
    • Marked as answer by Guntheria Wednesday, March 6, 2013 5:00 AM
    • Unmarked as answer by Guntheria Wednesday, March 6, 2013 5:00 AM
    Tuesday, March 5, 2013 10:57 PM
  • http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b

    And if you download this:

    http://1code.codeplex.com/

    You get the All-In-One code framework.  The samples you get from here are real working VS2010/12 projects... 

    I did a search just now for LINQ and C# and there were at least 200 hits.

    I then narrowed it down to just ADO.NET and there were about 30.


    JP Cowboy Coders Unite!

    • Marked as answer by Guntheria Wednesday, March 6, 2013 5:00 AM
    Tuesday, March 5, 2013 11:07 PM
  • On 3/5/2013 5:57 PM, Guntheria wrote:

    Wow! thanks for the tip.

    I guess what I'm trying to ask is: what if I want to return a query that doesn't correspond to a database table, but rather a mixture of a few tables. Do I need to define my own data entity?

    <http://www.linqpad.net/>

    <copied>

    LINQPad is also a great way to learn LINQ: it comes loaded with 500 examples from the book, C# 5.0 in a Nutshell.  There's no better way to experience the coolness of LINQ and functional programming.

    <end>

    Tuesday, March 5, 2013 11:48 PM
  • Well then you can look into Entity Framework...

    http://msdn.microsoft.com/en-us/library/bb399572.aspx

       And use LINQ over the top...


    JP Cowboy Coders Unite!

    Wednesday, March 6, 2013 12:07 AM
  • On 3/5/2013 7:07 PM, Mr. Javaman II wrote:

    Well then you can look into Entity Framework...

    http://msdn.microsoft.com/en-us/library/bb399572.aspx

        And use LINQ over the top...

    I have used the Entity Framework for a few years, professionally.

    Why would one use EF when he or she can query the database with LinqPad and learn Linq. On top of that, LinqPad is no different than SQL Server Management Studio, Toad, or Oracle's Management solution in their ability to query using T-SQL or P-SQL against a database table or tables, as a tool, and C# or VB.NET are not needed to do it.

    LinqPad is a tool that allows the querying using Linq to query the database tables, which is eventually translated into T-SQL or P-SQL to do the querying, and one doesn't need EF to do it, period. LinqPad is standalone by itself tool. It's a tool man a tool, and LinqPad is not a framework that you program against using C# or VB.NET, which is not unlike the tools that have been mentioned above.

    Surely, you can tell what is happening with it,  and the purpose of LinqPad as opposed to programming against EF to use Linq with C# or VB.NET, which is a Linq tool and a database tool that can also teach one to use Linq querying and things learned that can be used against EF and its Linq provider  or any other ORM like nHibernate that has a Linq provider to query the database through an ORM.

    Wednesday, March 6, 2013 2:02 AM
  • I have used the Entity Framework for a few years, professionally.


    Well I'm thinking if folks like you have used EF professionally for years, then why shouldn't a new person?  I never personally cared for LINQPad that much and learned most of LINQ hanging around in the forums and looking at the samples.  The best places I learned LINQ were not in the ADO.NET forum but over in the Reactive Extensions forum.  I guess it's just a matter of preference.  The reason I like EF for learning LINQ is the DB is abstracted to class like collections.  That's all.  I happen to have a lot of Databases at my disposal so it's simple for me to work up EF models and only takes two minutes.

    JP Cowboy Coders Unite!

    Wednesday, March 6, 2013 4:04 AM
  • I didn't ask the question worth a hill of beans, but the terms that helped me find what I need was: nested master/detail databinding, nested observable collection.

    • Edited by Guntheria Wednesday, March 6, 2013 5:01 AM
    Wednesday, March 6, 2013 5:00 AM
  • On 3/5/2013 11:04 PM, Mr. Javaman II wrote:

    I have used the Entity Framework for a few years, professionally.

    Well I'm thinking if folks like you have used EF professionally for years, then why shouldn't a new person?  I never personally cared for LINQPad that much and learned most of LINQ hanging around in the forums and looking at the samples.  The best places I learned LINQ were not in the ADO.NET forum but over in the Reactive Extensions forum.  I guess it's just a matter of preference.  The reason I like EF for learning LINQ is the DB is abstracted to class like collections.  That's all.  I happen to have a lot of Databases at my disposal so it's simple for me to work up EF models and only takes two minutes.

    It sounds like you have a personal problem with Linkpad that I could care less about it. It's a good learning tool is the bottom line, no if(s), and(s) or but(s) about it. You don't like LinkPad, though. It's not my problem. And I don't want you in my face over it again.

    Wednesday, March 6, 2013 5:49 AM