Segmenting definition and logic

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

Segmenting 1.png

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:

Segmenting 2.png

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

Segmenting 3.png

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:

Segmenting 4.png

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

Segmenting 5.png

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

Segmenting 6.png

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

Segmenting 7.png

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)

This page was edited 105 days ago on 01/11/2024. What links here