import flux88.NHibernate.Mappingmapping Test.Project, Test.Project.Entities entity Customer, table: Customers default_access: "nosetter.camelcase-underscore"entity Customer, identity "Id", generator: "native" property Name, column: "CustomerName", type: "String(12)", nullable: false property DateJoined, property Address, type: "String(200)" set _orders, access: "field", manyToMany Order, table: Orders, pk_column: "customer_id", fk_column: "order_id", inverse: true entity Order, table: Orders
Note that there isn't a ton of extra fluff, it's meant to be light-weight and easy to write. Additionally you could set defaults at the top (like default_access) so that you can avoid typing it all over your mappings.
Ayende added the notion of doing this:
for type in assembly.GetTypes(): continue if type.Namespace != "My.Model" entity type.Name, type.Namespace: idenity "id" for prop in type.GetProperties(): property prop.Name
You get the idea.
There could be a number of benefits of doing it like this. First, you can compile it, so you can get syntax errors notified. If you use the BooExplorer I'm pretty sure you'd get intellisense for this. I could also see plugging this into a model validator that would reflect over the model and make sure that all of the properties and access strategies will work with the mapping as defined.
Anyway, I have some reading up on DSL's to do... Ayende, that means I need you to write that book on DSLs with Boo :) Can I have it next week?
I'm Ben Scheirman. I am a .NET software developer with a strong interest in agility. I work as a Principal Consultant with Sogeti.
Read more here.
email me
Ads by The Lounge
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.