Segmenting definition and logic

This article was moved to MDriven Wiki Segmenting definition and logic

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


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:


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


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:


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:


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


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 entry was posted in Packages. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.