MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

object stereotypes and DataPortal #642

Open Chicagoan2016 opened 5 years ago

Chicagoan2016 commented 5 years ago

Question Hi All, Is there any limitation on what Datportal methods can be called from a certain object stereotype? RoleEditManager.cs in ProjectTracker has called DataPortal.CreateChild(), DataPortal.FetchChild() and DataPortal.Execute()

Kind regards Version and Platform CSLA version: 4.7.100 OS: Windows Platform: WinForms, WPF, ASP.NET Core, MVC, Xamarin, etc.

rockfordlhotka commented 5 years ago

No, as long as you understand the ramifications of each type of call.

jonnybee commented 5 years ago

And you should create CriteriaObjects (parameters object to root DataPortal methods) derived from CriteriaBase<>

Also be aware that DataPortal.Execute() is special case of DataPortal.Update() over the wire.

Chicagoan2016 commented 5 years ago

Thank you @rockfordlhotka and @jonnybee

@jonnybee , I never thought about DataPortal.Update()--- client side. Since Save() takes care of Inserts and updates.

kcabral817 commented 5 years ago

Also be aware that DataPortal.Execute() is special case of DataPortal.Update() over the wire.

I've been trying to understand why this statement invokes the update:

var obj3 = DataPortal.ExecuteAsync(obj2).Result;

BO [Csla.Server.ObjectFactory(typeof(SupplierFactory), "Create", "GetAsync", "UpdateAsync", "DeleteAsync", "ValidateAsync")] public async Task<SupplierInfoPersist> ValidateAsync(SupplierInfoPersist info) { var item = await DataPortal.ExecuteAsync(info); return item; }

FACTORY

 public object ValidateAsync(SupplierInfoPersist obj)
        {
            CheckRules(obj);
            return obj;
        }

I don't understand why the checkrules never gets executed, but the update fires. Any ideas?

kcabral817 commented 5 years ago

I think part of the issue is getting the message out to the developers. I heard about CSLA through Brian Lagunas. Had he not mentioned it in passing, I would not have adopted it. But just as importantly, we need to get into StackOverFlow for questions and answers to problems. That is where a lot of developers go when asking questions. Additionally, it's my belief we need representation at developer conferences, classes online, and support or mentoring on CodeMentor would not hurt.