Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Concerns regarding Linq [modified]

Concerns regarding Linq [modified]

Scheduled Pinned Locked Moved LINQ
csharpdatabasequestionlinqbeta-testing
3 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Harvey Saayman
    wrote on last edited by
    #1

    Hey guys... i just started Linq yesterday and feel comfortable with the basics(Building entity classes, insert, update, delete, etc) i have a couple of questions tho 1) What happens when the db creation script is altered(lets say a field is added to a table), does the entity classes update automatically? 2) In a larger db (about 85 tables), should i have one dbml file in my project with all the tables and work with that or split it up?. For instance there might be only 3 tables related directly to a user and 2 windows that use its data, should i create a dbml file with only the relevant tables for the relevant windows? 3) how are SQL exceptions handled??? (never mind, i saw SubmitChanges() throws out the exceptions) 4) i dont see return types on methods like SubmitChanges() or InsertOnSubmit() to even check that the insert for example actually took place? How can i get similar feedback? 5) can you recomend any good Linq articles from which i can learn more than the basics ive mentioned? <Edit> 6) Where does this leave stored procedures that simply select data? In the application im developing all the db stuff is done with stored procedures, even simple selects. The main reason would be that its pre compiled and it reduces sql injection risk. are injections posible if im using Linq? Any other thoughts on this subject? </Edit> Thanx

    Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

    you.suck = (you.passion != Programming)

    modified on Wednesday, July 23, 2008 7:25 AM

    P 1 Reply Last reply
    0
    • H Harvey Saayman

      Hey guys... i just started Linq yesterday and feel comfortable with the basics(Building entity classes, insert, update, delete, etc) i have a couple of questions tho 1) What happens when the db creation script is altered(lets say a field is added to a table), does the entity classes update automatically? 2) In a larger db (about 85 tables), should i have one dbml file in my project with all the tables and work with that or split it up?. For instance there might be only 3 tables related directly to a user and 2 windows that use its data, should i create a dbml file with only the relevant tables for the relevant windows? 3) how are SQL exceptions handled??? (never mind, i saw SubmitChanges() throws out the exceptions) 4) i dont see return types on methods like SubmitChanges() or InsertOnSubmit() to even check that the insert for example actually took place? How can i get similar feedback? 5) can you recomend any good Linq articles from which i can learn more than the basics ive mentioned? <Edit> 6) Where does this leave stored procedures that simply select data? In the application im developing all the db stuff is done with stored procedures, even simple selects. The main reason would be that its pre compiled and it reduces sql injection risk. are injections posible if im using Linq? Any other thoughts on this subject? </Edit> Thanx

      Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

      you.suck = (you.passion != Programming)

      modified on Wednesday, July 23, 2008 7:25 AM

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      HarveySaayman wrote:

      1. What happens when the db creation script is altered(lets say a field is added to a table), does the entity classes update automatically?

      No.

      HarveySaayman wrote:

      1. In a larger db (about 85 tables), should i have one dbml file in my project with all the tables and work with that or split it up?. For instance there might be only 3 tables related directly to a user and 2 windows that use its data, should i create a dbml file with only the relevant tables for the relevant windows?

      There are issues with single dbml files. One solution is to create multiple files - another is to create a business layer that manages this; believe me, it's not easy.

      HarveySaayman wrote:

      i dont see return types on methods like SubmitChanges() or InsertOnSubmit() to even check that the insert for example actually took place? How can i get similar feedback?

      Well, with LINQ you can check the conflict resolution[^] to see if there were any conflicts. Other problems would be thrown as exceptions.

      HarveySaayman wrote:

      1. Where does this leave stored procedures that simply select data? In the application im developing all the db stuff is done with stored procedures, even simple selects. The main reason would be that its pre compiled and it reduces sql injection risk. are injections posible if im using Linq? Any other thoughts on this subject?

      You don't need stored procedures to prevent SQL injection, you just need parameterised queries. There's always a place for stored procedures, but there's less overwhelming need. However, you can still use SPs with Linq, and this is a good thing. Stored Procs can cope with things that are a lot harder to do in LINQ, plus if there's a bug - it's easier to fix and deploy a stored proc when the code is in production than it is with an assembly.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      H 1 Reply Last reply
      0
      • P Pete OHanlon

        HarveySaayman wrote:

        1. What happens when the db creation script is altered(lets say a field is added to a table), does the entity classes update automatically?

        No.

        HarveySaayman wrote:

        1. In a larger db (about 85 tables), should i have one dbml file in my project with all the tables and work with that or split it up?. For instance there might be only 3 tables related directly to a user and 2 windows that use its data, should i create a dbml file with only the relevant tables for the relevant windows?

        There are issues with single dbml files. One solution is to create multiple files - another is to create a business layer that manages this; believe me, it's not easy.

        HarveySaayman wrote:

        i dont see return types on methods like SubmitChanges() or InsertOnSubmit() to even check that the insert for example actually took place? How can i get similar feedback?

        Well, with LINQ you can check the conflict resolution[^] to see if there were any conflicts. Other problems would be thrown as exceptions.

        HarveySaayman wrote:

        1. Where does this leave stored procedures that simply select data? In the application im developing all the db stuff is done with stored procedures, even simple selects. The main reason would be that its pre compiled and it reduces sql injection risk. are injections posible if im using Linq? Any other thoughts on this subject?

        You don't need stored procedures to prevent SQL injection, you just need parameterised queries. There's always a place for stored procedures, but there's less overwhelming need. However, you can still use SPs with Linq, and this is a good thing. Stored Procs can cope with things that are a lot harder to do in LINQ, plus if there's a bug - it's easier to fix and deploy a stored proc when the code is in production than it is with an assembly.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        H Offline
        H Offline
        Harvey Saayman
        wrote on last edited by
        #3

        Thanx pete OT: i still have some issues with the comparing of rows, haven't got the GetChangeSet() to work like i need it to... yet :). Still have some stuff im gona try but ill pick your brain tomorrow after exploring it a little more. thanx again

        Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

        you.suck = (you.passion != Programming)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups