ok,
I just started playing around with Rocky's 3.0 Csla.Wpf.CslaDataProvider code and I can't seem to get my head around something. (It's 5am and I'm still felling abit woozie after last nights party so maybe that has something todo with it).
I have a namespace called Gizmo.Orms.Core in with I have basicaly all my BO's coded and ready to go. In the Gizmo.Orms.Core.Error class. I have my factory methods, DataPortal methods etc. Pretty basic.
As I'm creating a WPF application, I'm trying to get one of the factory methods called on this Gizmo.Orms.Core.Error class called:
public static Error GetErrorByElevatorId(Guid ElevatorId){
if (!CanGetObject())
throw new SecurityException("No authorisation to view error.");
return DataPortal.Fetch<Error>(new Criteria(Criteria.enuErrorSelectCriteria.ElevatorId, ElevatorId));
}
So far so good, all pretty basic again.
In my Elevator.Xaml, which is a ResourceDictionairy, I have a ControlTemplate in which I'd like to bind to a property of the Gizmo.Orms.Core.Error class using a label object's value as input for the factory method.
I tried to get it working with the ObjectDataProvider and, I can see Rocky already frowning his eyebrows, came upon the already discussed problem of the constructors being called instead of the factory methods. Happy as a baby in new dypers when I read about the Csla.Wpf.CslaDataProvider class I was, I took an export of the repository and resseted (if thats even a word) my references from my Gizmo.Orms.Core to the latest Csla binairy.
Now here begins the drama
Eventhow I consider myself a prety good dev monkey, I cannot seem to figure out how to implement this in the codebehind of the Elevator.Xaml, Elevator.cs. I can instantiate the Csla.Wpf.CslaDataProvider and set the needed properties to the Gizmo.Orms.Core.Error class, but how do I get the factory method called using BeginQuery? As far as I can see it needs to be overriden, but then the question comes to mind... where??
My Gizmo.Orms.Core.Error class derives from BusinessBase<Error> and the Elevator.cs codebind for the Elevator.Xaml can't implement the CslaDataProvider as it is a partial class(due to the g.cs auto generated class, or wotever it's called:P).
Wot am I missing here Rocky? Some codebehind and xaml code examples would be very much apriciated.
Btw, the input for that factory method, ElevatorId, is in a label on the same Xaml.
Oh and guys, pls be gentle if I missed something obvious
Copyright (c) Marimer LLC