I am currently working on a new set of templates for CSLA 3.6 with Silverlight support with a MAJOR twist.
I plan on using the XML features in CodeSmith so that I can use an EDMX file as my data source.
My thoughts are, the designer allows us to abstract ourselves from the database slightly with the composite types etc...
Seems like a good fit and progress toward DDD for CSLA.
I thought about building a DSL toolkit much like the CSLAFactory but the Entity Framework designer seems like a nature replacement.
Does any one have interest in templates like this?
A little design, I am transforming the EDMX and extracting out the conceptual model section out of the EDMX for simplification. I then gen against the resulting XML. I plan on regenerating the intermediate XML for each generation.
You end up with tempate snippets like this:
[Serializable]
public class <%= EDMX.EntityTypes[ i ].Name %> : BusinessBase<<%= EDMX.EntityTypes[ i ].Name %>>
By stripping out the "extra" XML, the resulting templates are much simpler and readable:
Sample Public Property:
public <%= TypeConverter(EDMX.EntityTypes[ i ].Properties[i2].Type)%> CompanyName
{
get
{
return GetProperty(<%= EDMX.EntityTypes[ i ].Properties[i2].Name %>Property);
}
set
{
SetProperty(<%= EDMX.EntityTypes[ i ].Properties[i2].Name %>Property, value);
}
}
The EDMX file also contains some DB contraints such as "MaxLength" for strings. If fields are nullable etc.... Perfect for Data Validation logic.
I also plan on using the Entity framework because I also use Vista DB and they plan on adding support for the EF in Q4. I'd like to be able to generate classes for both MSSQL use and VistaDB use or at least have portable templates. EF's data provider story is very compelling to me and my business needs. (Frictionless offline support)
I'd like to get a feeling for the demand for something like this from the community.
I would like to preface that I use CodeSmithPro 5.0. I know quite a few folks use the older free version of codesmith so I'm not sure how that will effect compatabilty for some.
Hi,
I was wondering if any of you (or anyone else) was made any progress on this approach?
Thanks,
\ ^ / i l l
Nothing unfortunatly.
I was under a shipping deadline so I ended up going with Devforce for Silverlight and got the project out the door in no time.
I am still a big CSLA fan and love to see it's improvement.
Hi all,
There is an ongoing effort to generate CSLA objects from an EF model at:
It looks very promising !
Hello,
We are getting closer to this goal with our templates, but are still a ways out. We do have some people in our forums interested in adding support for this. maybe we could make this a team effort.
Thanks
-Blake Niemyjski
Hello,
I'm working on updating the templates to add support for Views and Stored Procedures. I might add that we now support Silverlight 4! I also have a patch for using Linq-To-SQL as the data access layer. I'd be willing to through some effort at generating from an EDMX file, please contact me or CodeSmith support if you are interested.
Thanks
-Blake Niemyjski
Copyright (c) Marimer LLC