dbschema.exe
dbschema.exe
inspects domain object assemblies to find domain object classes, their properties and attributes and generates the database schema - tables and views.
As the PhoneBook tutorial explains, a domain object class essentially is a set of properties (and attributes). Here is the sample Person class from the PhoneBook tutorial:
public class Person : DomainObject { [StringProperty(MaximumLength=60)] public virtual string FirstName { get; set; } [StringProperty(MaximumLength=60, IsNullable=false)] public virtual string Surname { get; set; } public virtual Location Location { get; set; } [DBBidirectionalRelation("Person", SortExpression="CountryCode, AreaCode, Number, Extension")] public virtual ObjectList<PhoneNumber> PhoneNumbers { get; set; } }
From such a declaration, dbschema.exe
generates a table and a view for persisting Person
objects. As you see in the illustration, the correspondence between class and table/view can be quite simple. In this case, the columns for Person
table and PersonView
view look exactly alike:
Not all cases are so simple, however. Persistence with re-store is discussed in FIXME. That page also answers the question why the PhoneNumbers
column is missing from the table/view shown above. (Just in case you wondered.)