public UserPartitionEntity() { TableName = "Users"; IdentityName = "User ID"; PrimaryKeys.Add("User ID"); Schema = "dbo"; }
public BCustomer() { TableName = "tb_BCustomer"; EntityMap = EntityMapType.Table; //IdentityName = "ISID"; PrimaryKeys.Add("ISID"); }
public void LoadData <T>(DbContext context, bool loadOnlyPKColumn) { var entityType = context.Model.FindEntityType(typeof(T)); if (entityType == null) { throw new InvalidOperationException("DbContext does not contain EntitySet for Type: " + typeof(T).Name); } var relationalData = entityType.Relational(); Schema = relationalData.Schema ?? "dbo"; Name = relationalData.TableName; TempTableSufix = Guid.NewGuid().ToString().Substring(0, 8); // 8 chars of Guid as tableNameSufix to avoid same name collision with other tables PrimaryKeys = entityType.FindPrimaryKey().Properties.Select(a => a.Name).ToList(); HasSinglePrimaryKey = PrimaryKeys.Count == 1; var properties = entityType.GetProperties().ToList(); if (loadOnlyPKColumn) { PropertyColumnNamesDict = properties.Where(a => PrimaryKeys.Contains(a.Name)).ToDictionary(a => a.Name, b => b.Relational().ColumnName); } else { PropertyColumnNamesDict = properties.ToDictionary(a => a.Name, b => b.Relational().ColumnName); ShadowProperties = new HashSet <string>(properties.Where(p => p.IsShadowProperty).Select(p => p.Relational().ColumnName)); } }
public User() { TableName = "Tb_User1"; IdentityName = "UserID"; PrimaryKeys.Add("UserID"); }
public void UpdateReadEntities <T>(IList <T> entities, IList <T> existingEntities) { var propertyNames = PropertyColumnNamesDict.Keys.ToList(); var selectByPropertyNames = PropertyColumnNamesDict.Keys.Where(a => PrimaryKeys.Contains(a)).ToList(); var accessor = TypeAccessor.Create(typeof(T), true); var existingEntitiesDict = new Dictionary <string, T>(); string uniquePropertyValues; foreach (var existingEntity in existingEntities) { uniquePropertyValues = GetUniquePropertyValues(existingEntity, selectByPropertyNames, accessor); existingEntitiesDict.Add(uniquePropertyValues, existingEntity); } for (var i = 0; i < NumberOfEntities; i++) { var entity = entities[i]; uniquePropertyValues = GetUniquePropertyValues(entity, selectByPropertyNames, accessor); if (!existingEntitiesDict.ContainsKey(uniquePropertyValues)) { continue; } var existingEntity = existingEntitiesDict[uniquePropertyValues]; foreach (var propertyName in propertyNames) { accessor[entities[i], propertyName] = accessor[existingEntity, propertyName]; } } }
public ScoreEntity() { TableName = "Score"; EntityMap = PWMIS.Common.EntityMapType.Table; PrimaryKeys.Add("stuID"); IdentityName = "stuID"; }
public StateChange(IModel model, Table table, TransactionChangeType type) { Model = model; Table = table; Type = type; PrimaryKeys = new PrimaryKeys(Table.PrimaryKeyColumns.Select(x => x.ValueProperty.GetValue(Model))); }
public bool IsPrimaryKey(string columnName) { if (null == PrimaryKeys) { return(false); } return(PrimaryKeys.Any(x => x.ColumnName == columnName)); }
public DataObject(string PrimaryField, string Table) { DefaultInitialization(Table); PrimaryKeys.Add(PrimaryField); TableName = Table; Refresh(); }
public UserEntity() { TableName = "Table_User"; //IdentityName = "标识字段名"; IdentityName = "UID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("UID"); }
private string ConstructPrimaryKeys(PrimaryKeys primaryKeys) { if (primaryKeys != null) { throw new NotImplementedException(); } return(""); }
public TestEntity() { TableName = "Table_Test"; //IdentityName = "标识字段名"; IdentityName = "ID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("ID"); }
public Dictionary <string, string> ConfigureBulkReadTableInfo(DbContext context) { InsertToTempTable = true; var previousPropertyColumnNamesDict = PropertyColumnNamesDict; BulkConfig.PropertiesToInclude = PrimaryKeys; PropertyColumnNamesDict = PropertyColumnNamesDict.Where(a => PrimaryKeys.Contains(a.Key)).ToDictionary(i => i.Key, i => i.Value); return(previousPropertyColumnNamesDict); }
public HotelPricePolicyView() { TableName = "HotelPricePolicyView"; Schema = ""; EntityMap = EntityMapType.View; //IdentityName = "标识字段名"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("Guid"); }
public UserPropertyView() { TableName = "LocalDB.用户属性视图"; EntityMap = EntityMapType.SqlMap; //IdentityName = "标识字段名"; IdentityName = "UID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("UID"); }
public AuctionOperationLog() { TableName = "AuctionOperationLog"; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; IdentityName = "OptID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("OptID"); }
public V_UserModels() { TableName = "MvcApplication1.Models.V_UserModels"; EntityMap = EntityMapType.SqlMap; //IdentityName = "标识字段名"; IdentityName = "C_USER_INFO_ID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("C_USER_INFO_ID"); }
public UserRoles() { TableName = "LT_UserRoles"; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; IdentityName = "ID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("ID"); }
public p_hege() { TableName = "p_hege"; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; IdentityName = "id"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("id"); }
public HotelPlatPolicy() { TableName = "HotelPlatPolicy"; Schema = ""; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("Guid"); }
public TblTestModel() { TableName = "FreeDrag_TblTest"; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; IdentityName = "ID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("ID"); }
public UserModels() { TableName = "C_USER_INFO"; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; IdentityName = "C_USER_INFO_ID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("C_USER_INFO_ID"); }
public TbCsEvent() { TableName = "TbCsEvent"; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; IdentityName = "EventID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("EventID"); }
public Table_User() { TableName = "Table_User"; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; IdentityName = "UID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("UID"); }
public RoomTypes() { TableName = "RoomTypes"; Schema = "dbo"; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("Guid"); }
public Table Inherits(List <Table> otherTables) { var inheritedDependency = ForeignKeys.FirstOrDefault(x => PrimaryKeys.Any(y => y.DbColumnName == x.DbColumnName)); if (inheritedDependency != null) { return(otherTables.FirstOrDefault(x => x.DbTableName == inheritedDependency.ForeignKeyTargetTable)); } return(null); }
public Dictionary<string, string> ConfigureBulkReadTableInfo(DbContext context) { InsertToTempTable = true; if (BulkConfig.UpdateByProperties == null || BulkConfig.UpdateByProperties.Count() == 0) CheckHasIdentity(context); var previousPropertyColumnNamesDict = PropertyColumnNamesDict; BulkConfig.PropertiesToInclude = PrimaryKeys; PropertyColumnNamesDict = PropertyColumnNamesDict.Where(a => PrimaryKeys.Contains(a.Key)).ToDictionary(i => i.Key, i => i.Value); return previousPropertyColumnNamesDict; }
public virtual void Initialize() { Schemas.ForEach(s => s.Initialize(Tables)); Tables.ForEach(t => t.Initialize(Schemas, Columns, PrimaryKeys, ForeignKeys, CheckConstraints)); Columns.ForEach(c => c.Initialize(Tables)); PrimaryKeys.ForEach(k => k.Initialize(Tables, PrimaryKeyColumns)); PrimaryKeyColumns.ForEach(c => c.Initialize(PrimaryKeys, Tables, Columns)); ForeignKeys.ForEach(k => k.Initialize(Tables, ForeignKeyColumns)); ForeignKeyColumns.ForEach(c => c.Initialize(ForeignKeys, Tables, Columns)); CheckConstraints.ForEach(c => c.Initialize(Tables)); }
public Platforms() { TableName = "Platforms"; Schema = "dbo"; EntityMap = EntityMapType.Table; //IdentityName = "标识字段名"; IdentityName = "ID"; //PrimaryKeys.Add("主键字段名"); PrimaryKeys.Add("ID"); }
public void AddPK(string table, string originalId) { if (!PrimaryKeys.ContainsKey(table)) { PrimaryKeys.Add(table, new Dictionary <string, string>()); } if (!PrimaryKeys[table].ContainsKey(originalId)) { PrimaryKeys[table].Add(originalId, originalId); } }
public async Task<PrimaryKeys> GetPrimaryKeysAsync(CancellationToken cancellationToken) { var builder = new ServiceManagementHttpClientBuilder(_subscription); var client = await builder.CreateAsync().ConfigureAwait(false); var detailedAccount = await client.GetIoTHubDetailsAsync(_iotHub, cancellationToken); var keys = new PrimaryKeys { IoTHubOwner = detailedAccount.GetIoTHubOwnerPrimaryKey(), Service = detailedAccount.GetServicePrimaryKey() }; return keys; }
public ClearDependenceItem(string sqlwhere, string StrParamName, string IntParamName, string ClearField1) { this.sqlwhere = sqlwhere; SqlParam = new PrimaryKeys(IntParamName, StrParamName); ClearFields = new string[]{ClearField1}; }
public DeleteDependenceItem(string sqlwhere , string StrParamName, string IntParamName) { this.sqlwhere = sqlwhere; SqlParam = new PrimaryKeys(IntParamName, StrParamName); }
public static string TableDifference(CompareSideType sideType, TableSchema schema1, TableSchema schema2, string[] primaryKeys, string[] exceptColumns) { TableCompare compare = new TableCompare(schema1, schema2) { SideType = sideType, ExceptColumns = exceptColumns }; IPrimaryKeys keys = new PrimaryKeys(primaryKeys); return compare.Compare(keys); }