/// <summary> /// Insert entities /// </summary> /// <param name="entities">Entities</param> public virtual void Insert(IEnumerable <T> entities) { try { if (entities == null) { throw new ArgumentNullException(nameof(entities)); } Entities.AddRange(entities); _context.SaveChanges(); } catch (DbEntityValidationException dbEx) { var msg = string.Empty; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { msg += $"Property: {validationError.PropertyName} Error: {validationError.ErrorMessage} {Environment.NewLine}"; } } var fail = new Exception(msg, dbEx); //Debug.WriteLine(fail.Message, fail); throw fail; } }
public Asp330SamIntegrationTests() { Repository = UnitOfWork.Asp330Sams; var mins = Faker.Random.Int(1, 1000); Entities.AddRange(FakerAsp330.Asp330SamFaker(mins, 4)); }
public Asp330DeviceIntegrationTests() { Repository = UnitOfWork.Asp330Devices; var lcdContrast = Faker.Random.Int(0, 500); Entities.AddRange(FakerAsp330.Asp330DeviceFaker(lcdContrast, 4)); }
public Asp330CertLimitIntegrationTests() { Repository = UnitOfWork.Asp330CertLimits; var certLimitDays = Faker.Random.Short(0, 360); Entities.AddRange(FakerAsp330.Asp330CertLimitFaker(certLimitDays, 4)); }
public async Task GetEntities(int page = 1, string parameter = "") { Wait = true; using (HttpClient httpClient = new HttpClient()) { var api = new ApiService <T>(httpClient); var s = BuildParamter(page, parameter); var response = await api.GetEntitiesAsync(s); if (response.IsSuccessStatusCode) { var result = await response.Content.ReadAsStringAsync(); Pagination = JsonConvert.DeserializeObject <Pagination <T> >(result); if (!string.IsNullOrEmpty(parameter)) { Entities.Clear(); } Entities.AddRange(Pagination.Data); } else { var content = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); if (response.Content != null) { response.Content.Dispose(); } MessagingCenter.Send(new SimpleHttpResponseException(response.StatusCode, response.ReasonPhrase, content), FAIL); } } Wait = false; }
public IErrorsInfo CreateEntities(List <EntityStructure> entities) { // ds = DMEEditor.GetDataSource(DatasourceName); Entities.AddRange(entities); // return ds.CreateEntities(entities); return(DMEEditor.ErrorObject); }
// The resulting HypermediaObject when it is a Query. Requires the query object so the self link can be build including the query string. // NavigationQuerys are additional Links like e.g. pagination "Next" or "First" public HypermediaCustomerQueryResult(ICollection <HypermediaObjectReferenceBase> entities, int totalEnties, CustomerQuery query) : base(query) { TotalEnties = totalEnties; CurrentEntitiesCount = entities.Count; Entities.AddRange(DefaultHypermediaRelations.EmbeddedEntities.Item, entities); }
protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw) { lock (Entities) { Entities.Clear(); Entities.AddRange(_arrow.Explode().Select(x => { if (x is DBText) { return(_convertToAttribute((DBText)x)); } return(x); })); ObjectId btrId = AcadBlocks.BlockTools.CreateBlockTableRecordEx(_insertPoint, "*U", Entities.Select(x => (Entity)x.Clone()).ToList(), AnnotativeStates.True); ObjectId brId = AcadBlocks.BlockTools.AddBlockRefToModelSpace(btrId, null, _insertPoint, _ucs); Tools.StartTransaction(() => { BlockReference br = brId.GetObjectForWrite <BlockReference>(); br.SetDatabaseDefaults(HostApplicationServices.WorkingDatabase); br.RecordGraphicsModified(true); Entity inMemoryEntity = (Entity)br.Clone(); draw.Geometry.Draw(inMemoryEntity); var btr = br.BlockTableRecord.GetObjectForWrite <BlockTableRecord>(); br.Erase(); btr.EraseBolckTableRecord(); inMemoryEntity.Dispose(); }); } return(true); }
public void CopyFrom(IServiceDefinition copyFrom) { if (copyFrom == null) { return; } var svcDef = copyFrom as ServiceDefinition; if (svcDef != null) { Entities.AddRange(svcDef.Entities); Operations.AddRange(svcDef.Operations); return; } Entities.AddRange( copyFrom.Enums .SelectMany(x => x) .Select(x => new EnumDefinition(x)) ); Entities.AddRange( copyFrom.Models .SelectMany(x => x) .Select(x => new ModelDefinition(x)) ); Operations.AddRange( copyFrom.ResourceOperations .SelectMany(x => x) .Select(x => new OperationDefinition(x)) ); }
/// <summary> /// Insert entities /// </summary> /// <param name="entities">Entities</param> public virtual DbContextTransaction Insert(IEnumerable <T> entities) { //hack to make bulk insert faster.... _context.Configuration.AutoDetectChangesEnabled = false; if (entities == null) { throw new ArgumentNullException(nameof(entities)); } var transaction = _context.Database.BeginTransaction(); try { Entities.AddRange(entities); _context.SaveChanges(); _context.Configuration.AutoDetectChangesEnabled = true; return(transaction); } catch (DbEntityValidationException dbEx) { transaction.Dispose(); throw new Exception(GetFullErrorText(dbEx), dbEx); } }
public Asp330CustomerCertIntegrationTests() { Repository = UnitOfWork.Asp330CustomerCerts; var date = Faker.Date.Future(); Entities.AddRange(FakerAsp330.Asp330CustomerCertFaker(date, 4)); }
public ProductionHto(ICollection <Domain.Production.ProductionLine> productionLines) { var productionLineHtos = productionLines.Select(p => new RelatedEntity("ProductionLine", new HypermediaObjectReference(new ProductionLineHto(p)))); Entities.AddRange(productionLineHtos); }
public Asp330FlukeIntegrationTests() { Repository = UnitOfWork.Asp330Flukes; var date = Faker.Date.Future(); Entities.AddRange(FakerAsp330.Asp330FlukeFaker(date, 4)); }
public Entity.ActionStatus InsertRange(List <T> entity) { _logger.InfoLog(LogHandler.Constants.ACTION_ENTRY, null, "", "", this.GetType().Name, MethodBase.GetCurrentMethod().Name); if (entity == null) { throw new ArgumentNullException("entity"); } var selfTran = false; if (!_uow.InTransaction) { _uow.BeginTransaction(); selfTran = true; } var _actionStatus = new Entity.ActionStatus(); try { // entity.RefId = entity.RefId == Guid.Empty ? Guid.NewGuid() : entity.RefId; Entities.AddRange(entity); _actionStatus = ApplyChanges(); if (!_actionStatus.Success) { throw new Exception(_actionStatus.Message); } // _actionStatus.Result = entity.RecordId; _actionStatus.Data = entity; _logger.InfoLog(LogHandler.Constants.ACTION_EXIT, null, "", "", this.GetType().Name, MethodBase.GetCurrentMethod().Name); } catch (Exception ex) { _logger.ErrorLog(ex, this.GetType().Name, MethodBase.GetCurrentMethod().Name); _actionStatus.Success = false; _actionStatus.Message = ex.Message; } finally { if (selfTran) { if (_actionStatus.Success) { _logger.InfoLog("Entity Inserted successfully,Committing Transaction", null, "", "", this.GetType().Name, MethodBase.GetCurrentMethod().Name); var _tactionStatus = _uow.EndTransaction(); if (!_tactionStatus.Success) { _actionStatus = _tactionStatus; } } else { _logger.InfoLog("Having issues while Inserting entity,Rollbaking transaction", null, "", "", this.GetType().Name, MethodBase.GetCurrentMethod().Name); _uow.RollBack(); } } } return(_actionStatus); }
internal void CheckCppEnd(CommandStatus status, Exception ex, List <EntityConfig> tables) { if (status == CommandStatus.Succeed) { Entities.AddRange(tables); } }
public void Insert(IList <Entity> Entity) // Add Range { if (Entity == null) { throw new ArgumentNullException(); } Entities.AddRange(Entity); }
public void LoadScene(IEnumerable <Entity> entities, BTScript script) { Entities.Clear(); Entities.AddRange(entities); BTScript = script; SceneLoaded?.Invoke(this, EventArgs.Empty); }
public void AddRange(IEnumerable <OdataObject> items) { Entities.AddRange(items); foreach (var item in items) { item.Parent = this; } }
public List <ChildRelation> GetChildTablesList(string tablename, string SchemaName, string Filterparamters) { EntityStructure ent = Entities.Where(p => p.EntityName.Equals(tablename, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); List <EntityStructure> ents = GetSeriesList(ent); Entities.AddRange(ents); return(null); }
public BlueprintQueryResultHto(ICollection <Domain.Design.RobotBlueprint> entities, BlueprintQueryParameters queryParameters) : base(queryParameters) { Count = entities.Count; var relatedBlueprints = entities.Select(b => new RelatedEntity(DefaultHypermediaRelations.EmbeddedEntities.Item, new HypermediaObjectReference(new RobotBlueprintHto(b)))); Entities.AddRange(relatedBlueprints); }
public void Insert(IEnumerable <TEntity> entities) { if (!entities.Any()) { throw new ArgumentNullException("entities"); } Entities.AddRange(entities); }
public void AddRange(IEnumerable <TEntity> entities) { if (entities == null) { throw new ArgumentNullException(nameof(entities)); } Entities.AddRange(entities); }
public virtual void Add(IEnumerable <T> entities) { if (entities == null) { return; } Entities.AddRange(entities); }
public EntityList Detect() { Entities.Clear(); foreach (var kvp in detectors) { Entities.AddRange(kvp.Value.Detect()); } return(Entities); }
private PaginatedListResult(IList <T> source, bool hasNext, bool hasPrevious, int count, int pageCount, int currentPage, int pageSize) : this() { HasNext = hasNext; HasPrevious = hasPrevious; Count = count; PageCount = pageCount; CurrentPage = currentPage; PageSize = pageSize; Entities.AddRange(source); }
public void InsertRange(IEnumerable <T> entities, int batchSize = 100) { if (entities == null) { throw new ArgumentNullException("entities"); } Entities.AddRange(entities); _context.SaveChanges(); }
public void Insert(IEnumerable <TEntity> entities) { if (entities == null) { throw new ArgumentNullException(nameof(entities)); } Entities.AddRange(entities); _context.SaveChanges(); }
private void Load() { List <TEntity> entities; var deserializer = new XmlSerializer(typeof(List <TEntity>)); using (TextReader reader = new StreamReader(RepositoryDataFile)) entities = (List <TEntity>)deserializer.Deserialize(reader); Entities.Clear(); Entities.AddRange(entities); }
public virtual void Insert(IEnumerable <TEntity> entities) { DbSetCheck(); if (entities == null) { throw new ArgumentNullException(nameof(entities)); } Entities.AddRange(entities); }
public static MetadataPlainObjects.Entities Generate(IActionConfiguration actionConfiguration, Dictionary<string, List<string>> routeRelations, object originalObject) { var rules = new MetadataPlainObjects.Entities(); actionConfiguration.EntityRules.ToList() .ForEach(rule => rules.Add(GenerateForRule(rule, actionConfiguration, routeRelations, originalObject))); var result = new Entities(); result.AddRange(rules.Where(r => r != null).ToList()); return result; }
public void AddRange(IEnumerable <DBEntity> entities) { Entities.AddRange(entities); foreach (var entity in entities) { if (IgnoreIndex) { continue; } AddToIndex(entity); } }