private static void CheckServiceAndRels(Assembly asm) { foreach (Type tp in asm.GetTypes()) { if (!tp.IsClass || tp.IsAbstract) { continue; } if (tp.IsPublic) { Type tpi = tp.GetInterface("I" + tp.Name, false); if (tpi != null && tpi.IsPublic && tp.IsSubclassOf(typeof(BusinessEntity))) { BaseFactory.RegisterObjType(tpi, tp); } if (tp.IsDefined(TRegisterService, true)) { BaseService.RegisterService(tp, BaseFactory.CreateInstance(tp)); } } foreach (RelationAttribute rel in (RelationAttribute[]) tp.GetCustomAttributes(typeof(RelationAttribute), true)) { try { MetaData.GetTableDef(rel._ParentType); } catch { } } } }
public static DataPersistance CreateDataPersistance( string EngineName, string ConnectionString, bool AutoCreateDb, string FolderLocation) { Type EType; if (DictEngine.TryGetValue(EngineName, out EType)) { return((DataPersistance)BaseFactory.CreateInstance(EType, ConnectionString, AutoCreateDb, FolderLocation)); } else { throw new ApplicationException("Engine Database tidak ditemukan !"); } }