Monday, October 26, 2009

Segmenting definition and logic

ECO makes it easy to define models. To reuse a model you can simply import a ecopkg.

image

This will make the package part of your model and you can edit the contents of the package. Code generation will also create new code and empty stubs for code implemented operations.

Normally you want to reuse the whole model assembly that may contain code implemented operations, maybe code derived attributes and relations and so on.

To do this you choose the “Edit referenced packages” option instead:

image 

Then choose “Add” and find a ecopkg you want to use as part of your complete model:

image

In this post I choose the EcoAspProvider.ecopkg that comes with the ECO install. This package implements the membership functions for ASP.NET as eco objects.

When referencing a package like this, the classes in the package are made read only. You can still draw associations to and from the classes in referenced packages as long as the association end is not embedded in any read only end. In other words: you can point out read only classes, but you cannot make a read only class point out anything new. Give this some thought and you will probably find it very intuitive; the external, referenced, definition cannot be changed in this context.

A referenced package is NOT code generated with the rest of the model. The referenced package probably comes with a compiled assembly or project of its own that use the definition in runtime. Add a reference to this as you would do with any other externally defined logic in .net:

image

If you try to change a property of a referred package ECO will stop you: image

To make your solution use the referred package you must click the choose package icon in the ecospace designer:

image

Then make sure that all packages you want to use are selected:

image

Then make sure you generate code and build your solution before you generate the schema (the schema is derived from the runtime model that is derived by looking on the code alone)

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

 
Contact Us | Terms of Use | Privacy Statement © 2009 CapableObjects