CSLA .NET 3.8.0 alpha 3 available

CSLA .NET 3.8.0 alpha 3 available

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


RockfordLhotka posted on Tuesday, September 29, 2009

Just in case you didn't have enough to look at with the 3.7.1 release and VB 3.6.3 release - here's more :)

CSLA .NET version 3.8.0 alpha 3 is now available.

The primary focus of version 3.8 is to enable more seamless support for the MVVM design pattern in Silverlight and WPF. The alpha 3 release brings the features I’ve been implementing in Silverlight into WPF.

Also, the samples downloads now include my MVVM experimental applications. I suppose you can call these samples, but they are really the apps I’m using to try out different ideas – so they aren’t what I’d consider a “full sample”. Still, you can see how the various new features work, and how the MVVM features allow creation of at least a basic CRUD UI (with some navigation) with no code-behind any XAML.

Please note that version 3.8 requires System.Windows.Interactivity.dll to build. This assembly is installed with Expression Blend 3, or the Blend 3 SDK. You must install at least the SDK before you can build CSLA .NET 3.8.0.

The new features (now in Silverlight and WPF) include:

Please give these new features a try and let me know your thoughts.

lukky replied on Wednesday, September 30, 2009

Thanks Rocky,

I was waiting to see that stuff for WPF Stick out tongue [:P]

skagen00 replied on Thursday, October 01, 2009

How much in flux is the 3.8.0 stuff? I've been following your blog postings and it sounded like you were getting closer to how you were going to handle eventing but still sounded like you were contending with having to do a couple hackish things to make commanding work between the view and viewmodel.

RockfordLhotka replied on Thursday, October 01, 2009

Commanding just doesn't work (out of the box anyway) with MVVM.

All the MVVM UI frameworks out there either replace or extend commanding.
CSLA .NET has InvokeMethod and Execute, both of which replace commanding -
and work on Silverlight where there is no commanding. They work with the
ViewModel class - so if you create your viewmodel classes by subclassing
ViewModel it just works.

Additionally, the ViewModelBase class can be used to create viewmodel
classes that work with any other UI framework. In fact, ViewModel is just
a subclass of ViewModelBase that adds public methods for
InvokeMethod/Execute. You can subclass ViewModelBase directly and create
your own public methods that work with any of the other MVVM UI frameworks
out there.

So 3.8 is not in flux anymore. I'm pretty comfortable with the approach I'm
using to support MVVM and the data provider models - both work well.

The last feature I'm adding to 3.8, for Beta 1, is support for data
annotation attributes. This is to integrate naturally with the way the
Silverlight DataForm works, but also with various other areas of .NET where
data annotations are becoming valuable.

While working on that, I discovered some oversights and bugs with
PropertyStatus (especially on WPF), so those will be fixed too.

I really hope to release beta 1 tomorrow (Friday), before I head to Orlando
for VS Live. And I really hope people take the time to give beta 1 a good
try, because now is the time to provide feedback. Once I get to beta 2 and
to release it is obviously too late to make any serious changes in now I'm
supporting MVVM, SL3 and data annotations.

Jack replied on Monday, October 05, 2009

Rocky,

I'm plugging in the ViewModel<T> as child ViewModels in my pre-exisiting UI ViewModel.  I'm going to expose them  as DataXyz depending on how many I end up using.

When I trigger a save I need to know that all the children have saved okay or do something specific post save.

Anyhow I need to subscribe to the Saved event which right now is only available by copying what you do in the ViewModelBase of (Model as ISaveable).Saved.  Would it not make sense to expose a Saved event in the ViewModel that you can trigger via OnSaved in the ViewModelBase.

Thanks

jack

RockfordLhotka replied on Monday, October 05, 2009

That is a good point. You could see that Model or Error changed - but that'd be awkward too.

I wonder if ViewModelBase shouldn't have a protected virtual OnSaved() that you can override to do any post-processing. If you want a public Saved method you could implement one, but if you just wanted your viewmodel to alter some properties (and thus indirectly the UI) you could do that too.

So you could do this:

protected override void OnSaved()
{
  if (Error != null)
    // handle exception
  else
    // handle new Model
}

Does this seem like a good plan?

Jack replied on Monday, October 05, 2009

Works perfectly for me.

 

From: RockfordLhotka [mailto:cslanet@lhotka.net]
Sent: October-05-09 3:06 PM
To: jaddington@alexandergracie.com
Subject: Re: [CSLA .NET] RE: CSLA .NET 3.8.0 Beta 1

 

That is a good point. You could see that Model or Error changed - but that'd be awkward too.

I wonder if ViewModelBase shouldn't have a protected virtual OnSaved() that you can override to do any post-processing. If you want a public Saved method you could implement one, but if you just wanted your viewmodel to alter some properties (and thus indirectly the UI) you could do that too.

So you could do this:

protected override void OnSaved()
{
  if (Error != null)
    // handle exception
  else
    // handle new Model
}

Does this seem like a good plan?



RockfordLhotka replied on Monday, October 05, 2009

Good, I’ll make it happen then.

 

Jack replied on Wednesday, October 07, 2009

Rocky,

 

I do not get or see how the CanSave is ever set to true.  The SetProperties is not really attached to very much.  Should it not fire when a property in the model changes or something?

 

I must be missing something...  I thought I was getting a lot of the plumbing from the DataProvider.

 

thanks

 

jack

 

From: Rockford Lhotka [mailto:cslanet@lhotka.net]
Sent: October-05-09 3:56 PM
To: jaddington@alexandergracie.com
Subject: RE: [CSLA .NET] RE: CSLA .NET 3.8.0 Beta 1

 

Good, I’ll make it happen then.

 



RockfordLhotka replied on Wednesday, October 07, 2009

This is a beta, and so there could very easily be bugs - which is why I'm so happy you are working with it! :)

This is ViewModel<T> you are using?

Jack replied on Wednesday, October 07, 2009

Yes.

 

I hooked up a save button with IsEnabled = MyUIModel.CanSave (SomeLogic && ViewModel<abc>.CanSave).  It never enables or updates.

 

I was expecting something to be connected to IsDirty etc.

 

thanks

 

From: RockfordLhotka [mailto:cslanet@lhotka.net]
Sent: October-07-09 7:28 AM
To: jaddington@alexandergracie.com
Subject: Re: [CSLA .NET] RE: RE: CSLA .NET 3.8.0 Beta 1

 

This is a beta, and so there could very easily be bugs - which is why I'm so happy you are working with it! :)

This is ViewModel<T> you are using?



Jack replied on Wednesday, October 07, 2009

If IsBusy then CanSave and CanCancel should be false

 

From: Jack Addington [mailto:cslanet@lhotka.net]
Sent: October-07-09 7:36 AM
To: jaddington@alexandergracie.com
Subject: RE: [CSLA .NET] RE: RE: CSLA .NET 3.8.0 Beta 1

 

Yes.

 

I hooked up a save button with IsEnabled = MyUIModel.CanSave (SomeLogic && ViewModel<abc>.CanSave).  It never enables or updates.

 

I was expecting something to be connected to IsDirty etc.

 

thanks

 

From: RockfordLhotka [mailto:cslanet@lhotka.net]
Sent: October-07-09 7:28 AM
To: jaddington@alexandergracie.com
Subject: Re: [CSLA .NET] RE: RE: CSLA .NET 3.8.0 Beta 1

 

This is a beta, and so there could very easily be bugs - which is why I'm so happy you are working with it! :)

This is ViewModel<T> you are using?

 



sergeyb replied on Wednesday, October 07, 2009

On the same OnSaved note, I think it would be nice to also have OnRefreshed as well. Reason being is that it would be nice to have a spot to plug in error handling during Refresh call. Thanks.

RockfordLhotka replied on Wednesday, October 07, 2009

sergeyb:
On the same OnSaved note, I think it would be nice to also have OnRefreshed as well. Reason being is that it would be nice to have a spot to plug in error handling during Refresh call. Thanks.

Yes, very good idea!

Jack replied on Wednesday, October 07, 2009

Should there be an OnXyz for any other?  OnCancelled, etc

 

Also would it be useful nice to be able to force a SetProperties call?

 

 

From: RockfordLhotka [mailto:cslanet@lhotka.net]
Sent: October-07-09 8:31 AM
To: jaddington@alexandergracie.com
Subject: Re: [CSLA .NET] RE: RE: RE: CSLA .NET 3.8.0 Beta 1

 

sergeyb:

On the same OnSaved note, I think it would be nice to also have OnRefreshed as well. Reason being is that it would be nice to have a spot to plug in error handling during Refresh call. Thanks.

Yes, very good idea!



RockfordLhotka replied on Wednesday, October 07, 2009

I don't understand what you are looking for then?

If I create DoRefresh(string factoryMethodName) as an overload you still can't pass your null?

Right now I can call DoRefresh() in several ways:

DoRefresh("NewCustomerEdit");

DoRefresh("GetCustomerEdit", 123);

DoRefresh("GetCustomerList", "Ander*", DateTime.Now);

and so forth.

What kind of call are you hoping to achieve that isn't currently covered?

sergeyb replied on Wednesday, October 07, 2009

I must be doing something wrong because in the downloaded version I did not see DoRefresh that takes one parameter - it seems to require two. Thanks. Sergey.

RockfordLhotka replied on Friday, October 09, 2009

Sergey and Jack, if you have the capability you should probably be grabbing the code out of svn directly. I've addressed some of the issues you've brought up, and will address more as time permits. I really appreciate your feedback - this is very useful!

Jack replied on Saturday, October 10, 2009

Unless I'm in the wrong spot I can't get to it.  I know I've done it before...

 

http://www.lhotka.net/cslacvs/viewvc.cgi/trunk/

 

An Exception Has Occurred

trunk: unknown location

HTTP Response Status

404 Not Found


Python Traceback

Traceback (most recent call last):

  File "C:\Program Files\viewvc-1.0.0\lib\viewvc.py", line 3629, in main

    request.run_viewvc()

  File "C:\Program Files\viewvc-1.0.0\lib\viewvc.py", line 314, in run_viewvc

    % self.where, '404 Not Found')

ViewVCException: 404 Not Found: trunk: unknown location

 

 

 

From: RockfordLhotka [mailto:cslanet@lhotka.net]
Sent: October-08-09 11:32 PM
To: jaddington@alexandergracie.com
Subject: Re: [CSLA .NET] RE: RE: RE: RE: CSLA .NET 3.8.0 Beta 1

 

Sergey and Jack, if you have the capability you should probably be grabbing the code out of svn directly. I've addressed some of the issues you've brought up, and will address more as time permits. I really appreciate your feedback - this is very useful!

RockfordLhotka replied on Saturday, October 10, 2009

I rearranged the svn repository last week. The new /trunk URL is

 

http://www.lhotka.net/cslacvs/viewvc.cgi/core/trunk/

Jack replied on Sunday, October 11, 2009

Rocky,

 

I had a question about the chaining of CSLADataProviders for parent/child and what the real use case of this is.  Is it basically just so you can databind to the child dp in lieu of the parent instead of using dot notation?  Can you provide a basic  example where this would benefit a developer?  I have lots of UOW type base objects with EditableChildLists.  I'm just trying to see where this would benefit me.

 

Moving further from that is where does the DataProvider fit with the ViewModel?  Does it fit in anymore?  Or is the fact we can do all that in simple code in the ViewModel mean we don't need it (my assumption).

 

 

From: RockfordLhotka [mailto:cslanet@lhotka.net]
Sent: October-08-09 11:32 PM
To: jaddington@alexandergracie.com
Subject: Re: [CSLA .NET] RE: RE: RE: RE: CSLA .NET 3.8.0 Beta 1

 

Sergey and Jack, if you have the capability you should probably be grabbing the code out of svn directly. I've addressed some of the issues you've brought up, and will address more as time permits. I really appreciate your feedback - this is very useful!

sergeyb replied on Wednesday, October 07, 2009

One more suggestion - have DoRefresh overload that does not take parameters, just factory method name. Thanks Sergey.

RockfordLhotka replied on Wednesday, October 07, 2009

I'm pretty sure DoRefresh() already takes the method name and a param array, so you can use no parameters.

sergeyb replied on Wednesday, October 07, 2009

True, you just cannot pass in Null for param array - Base class throws an exception. I had to pass in an empty array instead.

RockfordLhotka replied on Wednesday, October 07, 2009

Jack:

I hooked up a save button with IsEnabled = MyUIModel.CanSave (SomeLogic && ViewModel<abc>.CanSave).  It never enables or updates.

That sounds like a bug, I'll look into it.

Jack replied on Wednesday, October 07, 2009

Rocky,

 

Have you tried databinding to the Model property?  Say in a MainView with a few childViews.

 

<MyLib.SomeChildView x:Name="ChildViewABC" Model="{Binding Path=ChildViewABCModel}" />

 

Is that a supported feature?

 

thanks

 

jack

 

From: Jack Addington [mailto:jaddington@alexandergracie.com]
Sent: October-07-09 7:36 AM
To: 'cslanet@lhotka.net'
Subject: RE: [CSLA .NET] RE: RE: CSLA .NET 3.8.0 Beta 1

 

Yes.

 

I hooked up a save button with IsEnabled = MyUIModel.CanSave (SomeLogic && ViewModel<abc>.CanSave).  It never enables or updates.

 

I was expecting something to be connected to IsDirty etc.

 

thanks

 

From: RockfordLhotka [mailto:cslanet@lhotka.net]
Sent: October-07-09 7:28 AM
To: jaddington@alexandergracie.com
Subject: Re: [CSLA .NET] RE: RE: CSLA .NET 3.8.0 Beta 1

 

This is a beta, and so there could very easily be bugs - which is why I'm so happy you are working with it! :)

This is ViewModel<T> you are using?



RockfordLhotka replied on Thursday, October 08, 2009

I think that should work, though I don't know if I've tried it yet. Model is a dependency property though, so it should be a valid binding target.

sergeyb replied on Thursday, October 08, 2009

Onre more request - have OnStateChanged (or something like that)- called after Can__ properties are refreshed. Thank you. Sergey.

Luzius replied on Sunday, October 11, 2009

Hi Rocky,

 

do you plan to release an eBook/Video in the next couple months on the new features as an update to the 2008 book?

 

Regards Luzius

RockfordLhotka replied on Sunday, October 11, 2009

Yes, I am working on a video series for 3.8.

 

The planned structure for the video series is in two parts.

 

There’s the “core series” which is a 6 part set covering object design, data access, the data portal, security and so forth. Things that are common to any interface type. My plan is to sell this core series as a unit.

 

Then there’ll be interface-specific videos for WPF, ASP.NET MVC, etc. Those will be sold individually, but will assume you’ve seen the core series first.

Copyright (c) Marimer LLC