private List <ClrTypeEdmSet> GetClrTypeEdmSetList(IEdmModel edmModel, OeEntitySetMetaAdapterCollection entitySetMetaAdapters) { var clrTypeEdmSetList = new List <ClrTypeEdmSet>(); foreach (Type entityType in _tables.Keys) { OeEntitySetMetaAdapter metaAdapter = entitySetMetaAdapters.FindByClrType(entityType); IEdmEntitySet entitySet = edmModel.FindDeclaredEntitySet(metaAdapter.EntitySetName); clrTypeEdmSetList.Add(new ClrTypeEdmSet(entityType, entitySet)); } var orderedTypes = new List <ClrTypeEdmSet>(); while (clrTypeEdmSetList.Count > 0) { for (int i = 0; i < clrTypeEdmSetList.Count; i++) { PropertyInfo selfRefProperty; if (IsDependent(clrTypeEdmSetList[i], clrTypeEdmSetList, out selfRefProperty)) { if (selfRefProperty != null) { _tables[selfRefProperty.DeclaringType].SelfRefProperty = selfRefProperty; } orderedTypes.Add(clrTypeEdmSetList[i]); clrTypeEdmSetList.RemoveAt(i); break; } } } return(orderedTypes); }
public int SaveChanges(IEdmModel edmModel, OeEntitySetMetaAdapterCollection entitySetMetaAdapters, DataConnection dataConnection) { List <ClrTypeEdmSet> clrTypeEdmSetList = GetClrTypeEdmSetList(edmModel, entitySetMetaAdapters); int count = 0; for (int i = clrTypeEdmSetList.Count - 1; i >= 0; i--) { OeLinq2DbTable table = GetTable(clrTypeEdmSetList[i].ClrType); count += table.SaveInserted(dataConnection); UpdateIdentities(table, clrTypeEdmSetList, i); count += table.SaveUpdated(dataConnection); } for (int i = 0; i < clrTypeEdmSetList.Count; i++) { OeLinq2DbTable table = GetTable(clrTypeEdmSetList[i].ClrType); count += table.SaveDeleted(dataConnection); } return(count); }
public OeEfCorePostgreSqlOperationAdapter(Type dataContextType, OeEntitySetMetaAdapterCollection entitySetMetaAdapters) : base(dataContextType, entitySetMetaAdapters) { }
public OeEfCoreOperationAdapter(Type dataContextType, OeEntitySetMetaAdapterCollection entitySetMetaAdapters) : base(dataContextType) { _entitySetMetaAdapters = entitySetMetaAdapters; }