void InitDataDictionary(UnitOfWork dataSession)
 {
     using (UnitOfWork metadataSession = new UnitOfWork(metadataStorage)) {
         XPCollection <PersistentClassInfo> classes = new XPCollection <PersistentClassInfo>(metadataSession);
         PersistentClassInfo.FillDictionary(dataSession.Dictionary, classes);
     }
 }
        void CreateMetadata()
        {
            using (UnitOfWork uof = new UnitOfWork(metadataStorage)) {
                PersistentClassInfo classCustomer = new PersistentClassInfo(uof);
                classCustomer.Name = "Customer";

                PersistentCoreTypeMemberInfo propFullName = new PersistentCoreTypeMemberInfo(uof);
                propFullName.Name     = "FullName";
                propFullName.TypeName = typeof(string).FullName;
                classCustomer.OwnMembers.Add(propFullName);

                PersistentCollectionMemberInfo propOrders = new PersistentCollectionMemberInfo(uof);
                propOrders.Name = "Orders";
                classCustomer.OwnMembers.Add(propOrders);

                PersistentAssociationAttribute attrCustomerOrders = new PersistentAssociationAttribute(uof);
                attrCustomerOrders.ElementTypeName = "Order";
                propOrders.TypeAttributes.Add(attrCustomerOrders);

                PersistentClassInfo classOrder = new PersistentClassInfo(uof);
                classOrder.Name = "Order";

                PersistentCoreTypeMemberInfo propOrderDate = new PersistentCoreTypeMemberInfo(uof);
                propOrderDate.Name     = "OrderDate";
                propOrderDate.TypeName = typeof(DateTime).FullName;
                classOrder.OwnMembers.Add(propOrderDate);

                PersistentReferenceMemberInfo propCustomer = new PersistentReferenceMemberInfo(uof);
                propCustomer.Name          = "Customer";
                propCustomer.ReferenceType = classCustomer;
                classOrder.OwnMembers.Add(propCustomer);

                PersistentAssociationAttribute attrOrdersCustomer = new PersistentAssociationAttribute(uof);
                propCustomer.TypeAttributes.Add(attrOrdersCustomer);

                uof.CommitChanges();
            }
        }