biohazard999 / Para.FluentModelBuilder

Fluent Model Builder for the DevExpress.ExpressApp Framework
Microsoft Public License
4 stars 5 forks source link

How to separate UI classes from Domain Entities #1

Open petre-c opened 3 years ago

petre-c commented 3 years ago

Hello Manuel, This issue may not belong here so please move it to the proper place as you see fit.

Do you have a way to separate your Domain Model from the UI classes? So, effectively, create separate Domain Entities in XPO / EFCore & separate UI classes?

This, in my mind, would enable DDD-zation of persistent types.

Have a great day!

biohazard999 commented 3 years ago

Hello Petre!

While i have no direct way to decouple XAF in a DDD way (esp ID ValueTypes would require quite a lot of work) you can have a look into Xenial.Framework espacially UI decoupling is easy with https://docs.xenial.io/guide/layout-builders.html

Xenial is currently in preview stage and can be used for free and will launch on 22nd of may.

Please head over to https://github.com/xenial-io/Xenial.Framework/issues if you have any questions.

Kind regards Manuel

petre-c commented 3 years ago

Interesting!

From what I understand public setters are still mandatory on Business Objects, am I correct?

To my original question, can I use classes separate from Business Objects to generate the UI?

Thanks!

biohazard999 commented 3 years ago

@petrechitashvili

From what I understand public setters are still mandatory on Business Objects, am I correct?

Most editors will require public setters, but nothing hinders you from implementing editors that work reflection based with the objects

To my original question, can I use classes separate from Business Objects to generate the UI?

If I understand your question correctly -> you don't want to bind your business objects directly to the UI? That is also possible, but would require a lot of plumbing, and/or a lot of mapping code.

If you speak in terms of you don't want to pollute your model assembly with XAF attributes and layout, then Xenial is your canidate. Xenial is strictly speaking a evolution on all the techniques showed here.

petre-c commented 3 years ago

Most editors will require public setters, but nothing hinders you from implementing editors that work reflection based with the objects

Got it.

If I understand your question correctly -> you don't want to bind your business objects directly to the UI?

Correct.

That is also possible, but would require a lot of plumbing, and/or a lot of mapping code.

Do you know of an existing library / repo / method / article / anything to get me started on how to generate the UI from POCO / non-persistent classes, especially for handling collections / associations. Mapping with business objects would be relatively straightforward, to my mind. I could also try to do it all from scratch but I'd rather have something to bounce off of.

If you speak in terms of you don't want to pollute your model assembly with XAF attributes and layout, then Xenial is your canidate. Xenial is strictly speaking a evolution on all the techniques showed here.

I'm specifically interested in the Blazor UI. I saw the Xenial Blazor UI demo, I'll look deeper.

Thanks!

P.S. I just looked up the word Xenial - it really is a word 🙂 https://www.dictionary.com/browse/xenial

biohazard999 commented 3 years ago

Do you know of an existing library / repo / method / article / anything to get me started on how to generate the UI from POCO / non-persistent classes, especially for handling collections / associations. Mapping with business objects would be relatively straightforward, to my mind. I could also try to do it all from scratch but I'd rather have something to bounce off of.

No i don't know any lib that does that, the nearest thing i know is xenial ;)

Just a question: what is your need for such strict separation? I've done lots of projects DDD driven with XAF, although i never felt the need to be dogmatic by the book.

I'm specifically interested in the Blazor UI. I saw the Xenial Blazor UI demo, I'll look deeper.

Xenial it self is the first XAF modules to be designed strictly around winforms and blazor, I don't know if expand or other libs are built from the ground up to support this.

P.S. I just looked up the word Xenial - it really is a word 🙂 https://www.dictionary.com/browse/xenial

PS.: I know, thats why i choose the name in the first place ;)

petre-c commented 3 years ago

Just a question: what is your need for such strict separation? I've done lots of projects DDD driven with XAF, although i never felt the need to be dogmatic by the book.

I've suffered a lot, especially when working as part of the team, because of the public setters, specifically, and, hence, the inability to require instantiating domain objects with initial values.