What do you think of the following table mapping style for domain entities?
class Customer {
public string Name;
}
class Order
{
public TotallyContainedIn<Customer> Parent { get { return null; } }
public HasReferenceTo<Person> SalesPerson { get { return new HasReferenceTo<Person>(0,1); } }
}
//...
[TableOf(typeof(Customer))]
class CustomerTable
{
//...
public Mapping Name { get { return Column.Implements<Customer>(c=>c.Name); } }
}
[TableOf(typeof(Order))]
class OrderTable
{
//...
public FK CustomerID { get { return References.FK<CustomerTable>(ct=>ct.Id;); } }
}
What I'm trying to achieve, is having my domain model ready for writing code against as soon as i type that and compile, without a need for any code generation routines and dependence on any xml artifacts, and with ability to strongly reference everything i'm working with.
No matter how it will be implemented, do you think it would be easy to use it this way?