Hi,
I have recently started using CSLA.net. I really like the way the CSLA enforcing the best practices of class - object concepts. Thanks for such a nice framework.
And my question is on the architecture of application using CSLA.NET 4.
I saw some exising code in CSLA framework, where i have observed both Business layer(factory methods) and data access layer (Dataportal_Insert(), DataPortal_Delete()...etc) in the same class. I want to seperate the BAL and DAL, like all business layer related code in one class library project and the Data access layer related code in another project. Can we do this in CSLA ? if so, Please let me know the best practice to seperate and pros and cons, if any.
Thanks,
Arjun
Yes, you can.
Use the ObjectFactory pattern to separate BAL and DAL into separate assemblies.
This is my preferred coding style.
You can look at the SimpleNtier sample.
I often use a MEF container for IoC and buildup of DataAccess classes simply because it's sufficient for my needs and a standard component in .NET.
Pros:
Cons:
Sample:
[Serializable]
[Csla.Server.ObjectFactory(typeof(IOrderFactory))]
public class Order : BusinessBase<Order>
[Export(typeof(IOrderFactory))]
public class OrderFactory : ObjectFactory, IOrderFactory
{
When you use a MEFObjectFactoryLoader (available on http://CslaContrib.CodePlex.com)
Thank you very much for your suggestion, will start digging throgh the suggested concepts.
Thanks,
Arjun
The 'Using CSLA 4: Data Access' book from http://store.lhotka.net covers this topic in substantial detail.
Information is also on the FAQ: http://www.lhotka.net/cslanet/faq/DataFaq.ashx
Copyright (c) Marimer LLC