|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2011-04-13 12:29:45
Posts: 75,
Visits: 544
|
|
Hi All!
Can it be Real for ECO -- Dynamic package discovery.
When EcoSpace Loads modeled packages from reflection? can I Intercept it to allow or prohibit loading some assemblies?
Alex
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230,
Visits: 1 382
|
|
It is possible in Eco4 to dynamically select a set of packages and create a runtime model from those. This model can then be used to instantiate an ecospace.
Here is some code that should get you started:
====================================
using Eco.Internal;
ReflectionReader rr = new ReflectionReader();
List packages = new List();
packages.Add(typeof(MyPackage1));
packages.Add(typeof(MyPackage2));
IEcoTypeSystem ts = rr.Convert(packages);
PrototypeEcoSpace ecospace = new PrototypeEcoSpace(ts);
====================================
the class PrototypeEcoSpace is located in the assembly Eco.ModelLayer.Design.dll (In Eco5 it will move to Eco.Handles.dll). It is a very small class, so I'll paste the code below:
====================================
using Eco.Handles;
using Eco.Services;
using Eco.UmlRt;
using Eco.ObjectRepresentation;
namespace YourNameSpace
{
public class PrototypeEcoSpace: DefaultEcoSpace, ITypeSystemService
{
IEcoTypeSystem ITypeSystemService.TypeSystem
{
get { return m_TypeSystem; }
}
IEcoServiceProvider ITypeSystemService.StaticEcoServices
{
get { return this; }
}
private IEcoTypeSystem m_TypeSystem;
public PrototypeEcoSpace(IEcoTypeSystem typeSystem): base(typeSystem)
{
m_TypeSystem = typeSystem;
}
protected override ITypeSystemService GetTypeSystemProvider()
{
return this;
}
}
}
====================================
/Jonas Hogstrom [CapableObjects]
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2011-04-13 12:29:45
Posts: 75,
Visits: 544
|
|
it work.
m_TypeSystem = rr.Convert(packages, "ECOModel");
otherwise it will not compile either.
Alex
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230,
Visits: 1 382
|
|
I'm glad it works.
Sorry for missing the additional parameter to the Convert-method. That will be the name of the model in runtime, but it is not used internally by the framework, so you should be able to pass in any string you like.
/Jonas Hogstrom [CapableObjects]
|
|
|
|