Dinamic package discovering
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Dinamic package discovering Expand / Collapse
Author
Message
Posted 2008-10-13 16:22:55
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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
Post #579
Posted 2008-10-14 09:14:16
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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]
Post #583
Posted 2008-10-21 14:51:50
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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
Post #615
Posted 2008-10-22 14:46:40
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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]
Post #621
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom, PeterMorris

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 11:59

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0,297. 7 queries. Compression Disabled.