Hello,
i am new to CSLA and i am looking for some samples :
1) CSLA with linq to entities for example the CustomerList.Fetch.
2) An object factory in a seperate assembly, so my business objects are completely seperated from my database(s), so my application can run on different databases just by using a different DAL.
Can anyone help me find these samples ?
Thx
If you order the preview of the ebook then #2 should be answered there.
Rocky shows #1 with L2S in the book not L2E.
Joe
I downloaded the book and found this on p.18-6, isn't the fetch method missing in this class ?
What does this Fetch method return ?
Assuming the factory object is in a separate assembly, here’s an example of a
factory class with a
Fetch() method:public class CustomerFactory : ObjectFactory
{
using (var ctx = ConnectionManager<SqlConnection>.GetManager("MyDb"))
{
using (var cm = ctx.Connection.CreateCommand())
{
cm.CommandType = CommandTypes.Text;
cm.CommandText = "SELECT Id, Name FROM Customer WHERE id=@id";
using (var dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
var result = (BusinessLibrary.CustomerEdit)Activator.CreateInstance(
typeof(BusinessLibrary.CustomerEdit), true);
MarkNew(result);
result.LoadData(dr);
return result;
}
}
}
}
Copyright (c) Marimer LLC