What do I do without CSLA?

What do I do without CSLA?

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


dagware posted on Tuesday, October 23, 2012

First off, let me say that I love CSLA, and if I had any say in the matter, I'd continue to use it until they pried it from my cold, dead hands.

Unfortunately, they're prying it from my cold, dead hands. "The Powers That Be" at my company have decided that we can't use CSLA any more (it was only a small subset of developers that were using it). PLEASE, PLEASE, don't let this thread get bogged down in what I should do to change their minds. It's a done deal, and if I open my mouth about it one more time, I may get fired. I'm not kidding - that's how hard I've fought this.

So, here I am with a decision. I have a WPF MVVM application using the Repository pattern, among other things. I have no idea how to handle things like:

  1. Parent/child relationships where a child might get deleted, but I don't apply it until the user clicks save.
  2. How do I organize validation and business rules, so they get fired at the right time, and errors get reported to the binding?

Please don't misunderstand: Of course I know how to write this type of code. But I need to come up with code for doing all these types of things, that I can repeat over and over. I don't want to just pick any old way of doing it - I'd like a solid, reliable, repeatable way of doing this. I want to start out with best practices, not some hodge-podge half-baked scheme I manage to come up with through trial and error.

So, if anyone knows of some good examples of writing this type of code without CSLA, I'd appreciate it. It's funny how dependent I've become on CSLA. It's worked so well, there's been no need to even consider other ways of doing it. Until now, when I have a gun to my head and a pink slip waving in front of my face. Sigh.

So any help would be appreciated.

Dan

JonnyBee replied on Tuesday, October 23, 2012

Well, I  never thought I would write this in the CSLA forum.

There are some MVVM frameworks that offers some of the basics that CSLA has:

There is a good getting started post series and sample code on Catel on codeproject.com.

Don't know the other MVVM frameworks that much.

There's also some other Business Object Frameworks (both open source and commercial) but I have never used these.

dagware replied on Tuesday, October 23, 2012

LOL - I didn't think I'd ever be asking the question!

Thanks for the response. I'm sorry I didn't make this part clearer - I can't use *any* third-party framework for this, not just CSLA. I'm sure once I figure out how to do it, I can create some base classes or something, but no third-party frameworks.

So thanks for the recommendations, but they won't work.

The strange thing is, I've read tons of books on WPF and MVVM, and I've never seen any with decent parent/child business logic examples like what I'm talking about. They show how to write INotifyPropertyChanged, and IDataErrorInfo, but none of them show how to manage object states and things like that. If they use Entity Framework, they always assume attached entities, etc.

Any other ideas?

Dan

JonnyBee replied on Tuesday, October 23, 2012

So, no third party framework at all means that you will have to implement this by your self then. Tough luck.

No MVVM framework? No Business object framework? No logging framework?

Start with Rocky´s book Expert Business Objects 2008 and implement the necessary base classes yourself for business objects.
Seems like the only option you are left with by your company.

dagware replied on Wednesday, October 24, 2012

Thanks - I love Rocky's books, so I will indeed reference them. And I had a "duh" moment last night, when I remembered that have I actually taken a stab at this before. So now that my age-addled brain finally reminded me of this, I know what I'm going to do now. It's amazing how often I forget things these days. The information is still in the brain, but the indexes are broken. :)

Regarding using frameworks, we are allowed to use them, but they have to be Microsoft's. So, Unity, Prism, Entity Framework, etc. And I've written an extensive logging library, so we're allowed to use that. I can also sneak in some open source code now and then, like the Entity Framework SQL logging helper, but it can't be something that we can't easily replace if the need arises. I know, it doesn't make much sense, but that's my life. I keep reminding myself that I get paid to do what I love, so if I don't get everything my way, I try to remember that a lot of people make a living doing something they hate, so I'm fortunate. Yada yada, etc., etc.

Thanks, Jonny, for all your help. Not just in this post, but in all the other posts of yours I've read, that have been helpful. I just wanted you to know you're appreciated!

Dan

PS: It should go without saying, but I obviously also appreciate Rocky. More than he will ever know.

 

frankzmonroe replied on Saturday, October 27, 2012

Jonny, I am new to CSLA and so far I love it. The way you phrased your reply implies that one does not need to use Caliburn Micro when using CSLA. Is this accurate? is there a benefit to using BOTH in a solution, or using CSLA without Caliburn the preferred way to go.

Thanks for your help.

JonnyBee replied on Saturday, October 27, 2012

Hi,

We have done projects with BOTH Caliburn.Micro and CSLA and I do NOT intent to imply that CSLA covers Caliburn.Micro.

The fir well together. However Caliburn.Micro also has basclasses for INPC and databinding so if you were in a position of NOT being allowed to use CSLA then some basic parts in MVVM framework will help you build business objects.

Copyright (c) Marimer LLC