protected override void InsertItem(int index, T item) { base.InsertItem(index, item); lock (EntitySet.SyncRoot) { if (!suppressUpdatesToEntitySet) { suppressUpdatesFromEntitySet = true; EntitySet.Add(item); suppressUpdatesFromEntitySet = false; } } }
private static void ReadEntity(Type entityType, IEntitySet target, IDataRecord reader, IServiceLocator factory) { var prototype = factory.Get(entityType) as IEntity; if (prototype == null) { throw new InvalidOperationException($"There is no IEntity implementing object setup for {entityType.Name}"); } if (!prototype.ReadPrimaryKey(reader)) { return; } var entity = target.Find(prototype.PrimaryKeyValue); if (entity == null) { prototype.ReadSelf(reader); target.Add(prototype); entity = prototype; } foreach (var referrenceProperty in entity.GetReferenceProperties()) { var list = entity.OpenProperty(referrenceProperty.Item1); var propReader = reader.GetDeeperReader(referrenceProperty.Item1); ReadEntity(referrenceProperty.Item2, list, propReader, factory); } }
public async Task Add(IProduct product) { using (var scope = this._dbContextScopeFactory.CreateWithTransaction(System.Data.IsolationLevel.Unspecified)) { var productEntity = new Product { ProductId = product.ProductId, DateCreated = product.DateCreated, DateModified = product.DateModified, Description = product.Description, ProductName = product.ProductName }; _products.Add(productEntity); await scope.SaveChangesAsync(); } }
public IEntity AddPlayer(IEntity player, bool isClients = false) { var playerResult = isClients ? _playerCreator.CreateHostPlayer(player) : _playerCreator.CreateClientPlayer(player); if (isClients) { _myPlayer = player; _camera.SetEntity(_myPlayer, true); } if (playerResult.MouseDown != null) { foreach (var action in playerResult.MouseDown) { OnMouseDown += action; } } _players.Add(player); return(player); }
public void Add(Demographic entity) { Demographics.Add(entity); }
public void Add(Address entity) { Addresses.Add(entity); }
public void Add(Person entity) { People.Add(entity); }
public void Add(Parent entity) { ParentSet.Add(entity); }
public void Add(Product entity) { Products.Add(entity); }
public void Add(T obj) => _entities.Add(obj);
void IEntitySet <TEntity> .Add(TEntity entity) { _entitySet.Add(entity); _data.Add(entity); }
public void Add(ARecord entity) { ARecords.Add(entity); }
public void Add(BRecord entity) { BRecords.Add(entity); }
public void Add(User entity) { Users.Add(entity); }
public void Add(Blog entity) { Blogs.Add(entity); }