private void MenuItemBuildPanelSetCollection_Click(object sender, RoutedEventArgs e) { MongoDatabase mongoDatabase = YellowstonePathology.Business.Mongo.MongoTestServer.Instance.LIS; mongoDatabase.DropCollection("PanelSet"); MongoCollection mongoPanelSetCollection = mongoDatabase.GetCollection <BsonDocument>("PanelSet"); YellowstonePathology.Business.PanelSet.Model.PanelSetCollection psCollection = YellowstonePathology.Business.PanelSet.Model.PanelSetCollection.GetAll(); foreach (YellowstonePathology.Business.PanelSet.Model.PanelSet panelSet in psCollection) { panelSet.ObjectId = BsonObjectId.GenerateNewId().ToString(); YellowstonePathology.Business.Test.PanelSetOrder panelSetOrder = YellowstonePathology.Business.Test.PanelSetOrderFactory.CreatePanelSetOrder(panelSet); YellowstonePathology.Business.Persistence.PersistentClass persistentClassAttribute = (YellowstonePathology.Business.Persistence.PersistentClass)panelSetOrder.GetType().GetCustomAttributes(typeof(YellowstonePathology.Business.Persistence.PersistentClass), false).Single(); string assemblyQualifiedName = panelSetOrder.GetType().AssemblyQualifiedName; panelSet.PanelSetOrderClassName = assemblyQualifiedName; panelSet.PanelSetOrderTableName = persistentClassAttribute.StorageName; BsonDocument bsonDocument = YellowstonePathology.Business.Mongo.BSONBuilder.Build(panelSet); mongoPanelSetCollection.Insert(bsonDocument); } }
public static List <string> GetPSOInheritedCollectionNames() { List <string> result = new List <string>(); string assemblyName = @"C:\SVN\LIS\Business\bin\Debug\BusinessObjects.dll"; Assembly assembly = Assembly.LoadFile(assemblyName); Type[] types = assembly.GetTypes(); foreach (Type type in types) { object[] customAttributes = type.GetCustomAttributes(typeof(YellowstonePathology.Business.Persistence.PersistentClass), false); if (customAttributes.Length > 0) { foreach (object o in customAttributes) { if (o is YellowstonePathology.Business.Persistence.PersistentClass) { YellowstonePathology.Business.Persistence.PersistentClass persistentClass = (YellowstonePathology.Business.Persistence.PersistentClass)o; if (string.IsNullOrEmpty(persistentClass.StorageName) == false) { if (persistentClass.BaseStorageName == "tblPanelSetOrder" && string.IsNullOrEmpty(persistentClass.StorageName) == false) { string collectionName = persistentClass.StorageName.Substring(3); result.Add(collectionName); } } } } } } return(result); }
private void AddTransferDocuments(string assemblyName) { Assembly assembly = Assembly.LoadFile(assemblyName); Type[] types = assembly.GetTypes(); foreach (Type type in types) { object[] customAttributes = type.GetCustomAttributes(typeof(YellowstonePathology.Business.Persistence.PersistentClass), false); if (customAttributes.Length > 0) { foreach (object o in customAttributes) { if (o is YellowstonePathology.Business.Persistence.PersistentClass) { YellowstonePathology.Business.Persistence.PersistentClass persistentClass = (YellowstonePathology.Business.Persistence.PersistentClass)o; if (string.IsNullOrEmpty(persistentClass.StorageName) == false) { string collectionName = persistentClass.StorageName.Substring(3); string tableName = persistentClass.StorageName; YellowstonePathology.Business.Mongo.Transfer transfer = YellowstonePathology.Business.Mongo.Transfer.New(tableName, collectionName); transfer.AssemblyQualifiedName = type.AssemblyQualifiedName; transfer.HasBaseClass = persistentClass.HasPersistentBaseClass; if (persistentClass.HasPersistentBaseClass == true) { transfer.BaseTableName = persistentClass.BaseStorageName; } List <PropertyInfo> propertyList = type.GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(YellowstonePathology.Business.Persistence.PersistentPrimaryKeyProperty))).ToList(); transfer.PrimaryKeyName = propertyList[0].Name; if (persistentClass.HasPersistentBaseClass == true) { transfer.HasBaseClass = true; } this.m_TransferCollection.Add(transfer); } } } } } this.m_DocumentCollectionTracker.SubmitChanges(); this.NotifyPropertyChanged("TransferCollection"); }
public static List <string> GetPanelSetOrderDerivedTableNames() { List <string> result = new List <string>(); Assembly assembly = Assembly.LoadFile(@"C:\SVN\LIS\Business\bin\Debug\BusinessObjects.dll"); Type[] types = assembly.GetTypes(); foreach (Type type in types) { object[] customAttributes = type.GetCustomAttributes(typeof(YellowstonePathology.Business.Persistence.PersistentClass), false); if (customAttributes.Length > 0) { foreach (object o in customAttributes) { if (o is YellowstonePathology.Business.Persistence.PersistentClass) { YellowstonePathology.Business.Persistence.PersistentClass persistentClass = (YellowstonePathology.Business.Persistence.PersistentClass)o; if (string.IsNullOrEmpty(persistentClass.StorageName) == false && persistentClass.HasPersistentBaseClass == true && persistentClass.BaseStorageName == "tblPanelSetOrder") { result.Add(persistentClass.StorageName); } } } } } return(result); }