Answered Linq To Sql in C#

  • Tuesday, January 22, 2013 10:27 AM
     
     

    i am new to LinqToSql approach in 3 tier arch,

    1. When i get a result using Linq query in DataAccessLayer, what should be the return type of    method in DataAccessLayer and also in BusinessAccessLayer?

    2. What advantages LinqToSql classes have over ADO.NET?

    3. Does all the data manipulation in LinqToSql dependent on collection and generics?

    4. Which is most suitable method LinqToSql or ADO.NET?

    5. What is repository? Does it necessary in LinqToSql? 

All Replies

  • Tuesday, January 22, 2013 11:09 AM
     
      Has Code

    Here is the ans....

    1. When i get a result using Linq query in DataAccessLayer, what should be the return type of    method in DataAccessLayer and also in BusinessAccessLayer?

    public List<string> getValue()
    {
    var lvar = from lT in dc.TableName
               select lT;
    
    List<string> lstString = new List<string>();
    foreach(var lVarValue in lvar)
    {
        lstString.Add( lVarValue.ID.ToString()); 
    }
    
    return lstString ;
    }
    

    above will be in the DataAccessLayer and the properties, Interface etc will be in the BusinessAccessLayer .

    If you need any further deep information on 3 tier architecture then let me know i will assist you...

    2. What advantages LinqToSql classes have over ADO.NET?

    My option is LinqToSql... easy to use and fast.....

    3. Does all the data manipulation in LinqToSql dependent on collection and generics?

    4. Which is most suitable method LinqToSql or ADO.NET?

    LinqToSQL

    5. What is repository? Does it necessary in LinqToSql?

    Dont have ans...

    If you find my ans helpful then plzzz mark this as ans....

  • Tuesday, January 22, 2013 11:17 AM
     
     

    Hi,

    Check this link

    http://stackoverflow.com/questions/593808/what-are-the-advantages-of-linq-to-sql

    Advantages

    • Quick turn around for development
    • Queries can be dynamically
    • Tables are automatically created into class
    • Columns are automatically created into properties
    • Relationship are automatically appeaded to classes
    • Lambda expressions are awesome
    • Data is easy to setup and use

    Go through the linq to learn querying using linq its really a nice one

    http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b


    -Arun

  • Wednesday, January 23, 2013 2:50 AM
     
     

    Hi nirajzambad,

    From your description, I’ll move it to Linq to SQL Forum for better support. Experts there will help you on this topic.

    Thanks for your understanding.

    Regards, 


    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Wednesday, January 23, 2013 10:04 AM
     
     Answered

    If you are newbie in LINQ to SQL, I'd suggest you watch this videos:

    http://www.asp.net/web-forms/videos/data-access/how-do-i-with-linq/how-do-i-linq-to-sql-overview

    http://www.asp.net/web-forms/videos/data-access/linq-videos-from-the-vb-team/how-do-i-get-started-with-linq

    These tutors are giving a perfect explanations.


    Please Mark as Reply and Vote as Helpful if I helped.

    Also please visit my blog http://msguy.net/