Trouble adding project references

Oct 6, 2008 at 2:26 PM

Hi,
First of all, congratulations for this fantastic work. I've started using Sculpture.Net as a foundation for a set of tools I'm building around DSLs. In order to let the user select a custom build action for a template output (for instance "Embeded Resource" for NHibernate mapping files, "None" for svc files, etc.) I already modified some code and found it really easy to extend.
Now, I'm trying to have the engine automaticaly add the required references between all projects in the solution. Since the project relationships are well known (cf. last post) and the mold contains a property telling which project is used for each layer (BEProject, SIProject, DAProject, etc.) I thought it would be straightforward to generate these references at runtime. Unfortunately I got lost in the way the model needs to be read. :-( For instance, in order to retrieve which project in the solution holds the Business Entities, I tried to hook this piece of code inside the Generate() method of the DSL Package Generator :
DynamicProperty dp= sortedMolds.Find(t => t.Name == "MoldBase").Properties.Find(t=>t.Name=="BEProject");

But the dynamic property's value is alwas set to null. I'd greatly appreciate if someone could point me to the right direction in order to retrieve the values of the mold instance properties, or tell me where I could find some documentation.
Thanks, and keep up the great job !

Oct 10, 2008 at 8:48 AM
In case someone is interested by the workaround I found in the meantime : I managed to identify all actual projects names with their corresponding alias by parsing the xml in the ExternProps property of the sculptureModel object. This allowed me to automaticaly add all required inter-project references during generation. It works, but any hint on using a cleaner way to obtain the information (rather than parsing the xml) would be appreciated.:-)

 

Oct 12, 2008 at 11:10 AM
Hi Olivierb,

Sorry for late in replay, about getting the value of specific element in the model, Sculpture provide ModelElementHelper API to simply get or set values to the elements properties.
in your case you can type the following code to retrieve the 'BEProject' property from the sculpture Model.

string value = ModelElementHelper.GetModelElementPropertyValue(sortedMolds, sculptureModel, "MoldBase", "BEProject");

If you need more information you are welcome ...

Negm
Oct 13, 2008 at 10:28 AM

Thank you for your answer Anegm,

though my trick with the XML document was working I'm glad I could switch to something more elegant and easier to read !  Is there somewhere a kind of documentation about the DSL itself and these helper APIs ?

Regards,

Olivier

----- Original Message -----
From: ANegm
Sent: 10/12/08 12:10 pm
To: olivierb_@gmx.com
Subject: Re: Trouble adding project references [Sculpture:37125]

From: ANegm

Hi Olivierb,

Sorry for late in replay, about getting the value of specific element in the model, Sculpture provide ModelElementHelper API to simply get or set values to the elements properties.
in your case you can type the following code to retrieve the 'BEProject' property from the sculpture Model.

string value = ModelElementHelper.GetModelElementPropertyValue(sortedMolds, sculptureModel, "MoldBase", "BEProject");

If you need more information you are welcome ...

Negm
Oct 23, 2008 at 11:01 AM
Olivierb

This APIs not a part of DSL, but the Sculpture Team build it as Common Helpers.
You can find all helper APIs , in the "common" project.

Negm