Saturday, March 25, 2006

The EntitySpaces esPlugIn for MyGeneration not only allows for end-user customization it also allows us (and eventually you) to more easily author templates for EntitySpaces. Take a look at this very simple code snippet.

<%
    ITable table = MyMeta.Databases["Northwind"].Tables["Employees];
   
    source = new EntitySpaces.PlugIn.esPluginSource(table, null); 
%>

 public partial class <%=esPlugIn.Entity(source)%> : <%=esPlugIn.esEntity(source)%>
 {

 }

The output from the template is as follows 

 public partial class EmployeesCollection : esEmployeesCollection
 {

 }

If you wanted your collections to end in "Coll" instead of "Collection" you could change the C:\Program Files\MyGeneration\Settings\esPluginSettings.xml file. The entry for collections looks like this:

<esSetting Name="sCollection" Value="Collection" />

You just need to change "Collection" to "Coll" and regenerate. While this might not seem like a real-world scenario controlling your stored procedure names is much more likely. Also, and even more importantly 3rd party developers should also use the esPlugIn API in their templates to ensure they will work with everybody's configuration.

If you really want to see how this works try the esPlugIn template for MyGeneration, it's installed with the beta, it allows you to programatically change the settings, however, settings should always be made in the esPluginSettings.xml file. You can use the template to play around with the settings to get things the way you like them. We recommend the settings we've shipped with however, but the escape hatch is there for you.

The help file for the esPlugIn.dll is on your windows menu if you have installed EntitySpaces, it is also online at http://www.entityspaces.net/Documentation/esPlugIn/index.html 

posted on Saturday, March 25, 2006 9:59:40 PM (Eastern Standard Time, UTC-05:00)  #