locked
LINQ in N-tier architecture RRS feed

  • Question

  •  

    Hi,

    I have business class like this:

    Class customer

    {

    //Properties for Name and customerID.

    //Fields

    }

    From the LINQ I am getting the result like this:

    var s = from c in customers where customerID =1 select c.CustomerID, c.Name;

    Now I want to populate the business class customer object with the values from s.

    How to do this?

    How LINQ is used in N-tier architecture.

     

    thanks in advance

    Tuesday, December 18, 2007 7:11 PM

All replies

  • Do you want something like this?:

    Code Block

    var customer =

      customers
        .Single(c => c.CustomerID == 1)
        .Select(c => new Customer { CustomerID = c.CustomerID, Name = c.Name };


      
    Tuesday, December 18, 2007 7:43 PM
  •  

    Hi,

     My question is how to populate the Business objects using LINQ results.

     

    Thanks

    Tuesday, December 18, 2007 9:02 PM