Using CSLA.NET for both ASP.NET and Silverlight Applications

Using CSLA.NET for both ASP.NET and Silverlight Applications

Old forum URL: forums.lhotka.net/forums/t/10457.aspx


rcollette posted on Tuesday, June 21, 2011

I have read C# 2008 business objects and I am currently reading pro silverlight 4 in c#.   While reading this book, I am trying to keep in the correct frame of reference for what I will be doing when developing a Silverlight business application.

Can I somehow develop a business object assembly and use that same assembly for both Silverlight and ASP.NET (or other UI) projects?  If so how?   Or do I, can I, develop my business object assembly using CSLA.NET for Silverlight and get dual use (server and client)?   If neither of these is an option, can I create two projects and use file links to the same source code, but just reference the two CSLA.NET versions, one in each project.

My initial thought was that business objects just use messaging over the wire and that should allow two similar binaries to be compatible, but then the fact that regular assemblies don't run on Silverlight comes up in the book I'm reading and my doubts crept in.

I tried searching for this on this site and I am sure it has been answered already but I probably did not come up with the correct search terms.

Thank you,

Rich

RockfordLhotka replied on Tuesday, June 21, 2011

Yes, absolutely. You just need to take a few (relatively simple) precautions in how you build your business library code to minimize the impact of running on multiple platforms. There are some fundamental differences between Silverlight and .NET that can cause issues. CSLA hides most of them from you, but there are a couple you have to deal with.

The CSLA 4 version 4.1 Samples\Net\cs\SimpleNTier sample shows how to build a solution with numerous types of UI - including ASP.NET MVC and Silverlight - so it should get you started.

The Using CSLA 4 ebook series covers all of this in quite a lot of detail, so if you want more in-depth discussion about designing classes and data access code for your scenario that's probably the way to go.

rcollette replied on Tuesday, June 21, 2011

Excellent.  Thanks for the quick response.   At least now I can finish this book in the next week and a half and not have to be distracted thinking too much about what is going to have to happen in the BO layer.

 

Copyright (c) Marimer LLC