Results 1 to 7 of 7

Thread: Entity Framework and LINQ

  1. #1

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Entity Framework and LINQ

    Hey,

    I was wanting to get peoples impressions of the Entity Framework and LINQ.

    I like the idea of having the mapping of classes to the relational databe handled but as I understand it for this to work we have to use LINQ.

    My manager isnt keen on having query code in the business end as he is adament that this should be handled by Stored Procs by the DBA's. His argument is that they are better placed to build tuned queries in SQL Management Studio.

    Any peopples thoughton the above is appreciated.

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: Entity Framework and LINQ

    Hey,
    If you're using an ORM like NHibernate, you don't need to use LINQ.
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Re: Entity Framework and LINQ

    So I could have a stored proc i.e.

    select a.x, b.x from
    a innerjoin
    b on a.y = b.y

    and two classes classa and classb, using nHibernate I could map a.x to class a and b.x to class b.

    If I had these classes bound to a datagrid and updated a row, presumably I would have to write a stored proc to handle any column, something LINQ would automatically handle?

    Is the use of SPs only available with Hibernate or in the MS Entity Framework. What are peopples general opinions on LINQ over SPs

  4. #4
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: Entity Framework and LINQ

    Sorry I missed the stored procedure part. As far as what I have seen with NHibernate and other ORM models, stored procedures are irrelevant, simply because the the ORM doesn't care what the underlying data storage model is. An ORM lets you switch between databases.

    There are different schools of thought as to where the business logic should reside. I have always been in favor of keeping it close to data aka "database stored procs". There are other schools of thought and if you're building a product it would be good if you weren't going to tie yourself down to a single database.

    In that case you would be better off using LINQ.

    As far as performance goes, I fear your manager is not completely wrong. Stored procedures can be extremely efficient in doing certain things, where an ORM might take time.

    With faster and faster computers and good network connectivity, this too might be a thing of the past.
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  5. #5
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Re: Entity Framework and LINQ

    I hear with SQL Server 2005, the performance gap between stored procedures and direct queries has shrunk.

    FishGuy, it really depends on how you want to design the application. If it's a closed environment where the only way users can enter data is through the app front end, it really doesn't matter (from an architecture perspective) if you use stored procs inside the database or build a business layer with LINQ to handle things. However if you want to expose your application functionality through APIs, you may want to look at LINQ more closely. Another important point is building all the business logic in the application layer will allow you to deploy parts of the application on separate application servers, while leaving the database server the same. Kind of a distributed architecture. This works well for applications which need to scale up. If you are heavily into stored procs, scaling up at the database level could be a big challenge.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  6. #6

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Re: Entity Framework and LINQ

    Thanks, for your replies.

    I will have to experiement as with a mock project and see how it could work for me. Im interested in different design patterns but totally at a loss as to what technology I should be using for what i.e. WCF, WPF, MVC, Entity Framework, Binding to Datasets, Object Collections.

    I know there is no easy answer and it probably depends on each situation and it's merits but I was just interested in what others thought in the community.

  7. #7
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Re: Entity Framework and LINQ

    Each pattern addresses a specific design issue. So they aren't really alternatives per se. For e.g. you cannot decide between WPF and WCF, as one deals with presentation/client side rendering, while the other deals with communication between different components of your application. You could have a combination of two, i.e. you could have a WCF framework for communication, but build each service/class component using Entity Framework.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width