Login Skip Navigation LinksWilsonORMapper > Examples > Mappings Search
Demo Version Demo Version
Download and try for yourself a fully working demo version, including sample apps and documentation.  The only limitation is that the demo version only works inside the debugger.

PayPal Subscribe
Get It All for $50 USD:
WebPortal, ORMapper,
Source Code, All Updates
PayPal

Wilson ORMapper Examples Wilson ORMapper Examples

Example Mappings

<?xml version="1.0" encoding="utf-8" ?>
<mappings version="4.2" defaultNamespace="Wilson.ORMapper.Example">
  <entity type="Category" table="Categories" keyMember="id" keyType="User"
      sortOrder="CategoryDesc ASC">
    <attribute member="id" field="CategoryId" alias="Id" />
    <attribute member="description" field="CategoryDesc" alias="Description" />
    <relation relationship="ManyToMany" member="contacts" field="ContactId"
      type="Contact" lazyLoad="true" cascadeDelete="true"
      table="CategoryContacts" sourceField="CategoryId" destField="ContactId" />
  </entity>
  <entity type="Contact" table="Contacts" keyMember="id" keyType="Auto"
      sortOrder="ContactType DESC, ContactName ASC" typeField="ContactType" typeValue="?">
    <attribute member="id" field="ContactId" alias="Id" />
    <attribute member="name" field="ContactName" alias="Name" />
    <attribute member="address.line" field="AddressLine" alias="Address.Line" />
    <attribute member="address.city" field="AddressCity" alias="Address.City" />
    <attribute member="address.state" field="AddressState" alias="Address.Staet" />
    <attribute member="address.zip" field="AddressZip" alias="Address.Zip" />
    <relation relationship="ManyToMany" member="categories" field="CategoryId"
      type="Category" lazyLoad="true" cascadeDelete="true"
      table="CategoryContacts" sourceField="ContactId" destField="CategoryId" />
    <relation relationship="OneToMany" member="details" field="ContactId"
      type="Detail" lazyLoad="true" cascadeDelete="true" />
  </entity>
  <subEntity type="Person" inherits="Contact" typeValue="P" />
  <subEntity type="Business" inherits="Contact" typeValue="B">
    <attribute member="company" field="CompanyName" alias="Company" />
  </subEntity>
  <entity type="Detail" table="ContactDetails" keyMember="id" keyType="Guid"
      sortOrder="DetailInfo ASC" typeField="DetailType" typeValue="?">
    <attribute member="id" field="DetailId" alias="Id" />
    <attribute member="info" field="DetailInfo" alias="Info" />
    <attribute member="comment" field="DetailComment" alias="Comment" />
    <attribute member="contactId" field="ContactId" alias="ContactId" />
    <relation relationship="ManyToOne" member="contact" field="ContactId"
      type="Contact" lazyLoad="false" />
  </entity>
  <subEntity type="Phone" inherits="Detail" typeValue="P" />
  <subEntity type="Email" inherits="Detail" typeValue="E" />
</mappings>