/// <summary> /// Gets the Assumed Entity by Assumption Attribute Type, casting it to the Entity Type. /// </summary> /// <typeparam name="TAssumption"></typeparam> /// <returns></returns> /// <exception cref="System.Exception"></exception> public Entity Get <TAssumption>() where TAssumption : EntityDataAssumptionBaseAttribute { if (!InternalStore.TryGetValue(GetKey <TAssumption>(), out Entity entity)) { throw new Exception($"AssumedEntities does not contain an entity for Assumption {typeof(TAssumption).Name}."); } return(entity); }
public void Commit() { if (InternalStore.Count > 0) { DataTable dt; int numberOfPages = (InternalStore.Count / CommitBatchSize) + (InternalStore.Count % CommitBatchSize == 0 ? 0 : 1); for (int pageIndex = 0; pageIndex < numberOfPages; pageIndex++) { dt = InternalStore.Skip(pageIndex * CommitBatchSize).Take(CommitBatchSize).ToDataTable(); BulkInsert(dt); } } }
/// <summary> /// load list to the data base /// </summary> /// <returns>number of register rows</returns> public long Commit() { long rowAffected = 0; if (InternalStore.Count > 0) { DataTable dt; int numberOfPages = (InternalStore.Count / CommitBatchSize) + (InternalStore.Count % CommitBatchSize == 0 ? 0 : 1); for (int pageIndex = 0; pageIndex < numberOfPages; pageIndex++) { dt = InternalStore.Skip(pageIndex * CommitBatchSize).Take(CommitBatchSize).ToDataTable(); rowAffected += BulkInsert(dt); } } return(rowAffected); }
public void Commit() { if (InternalStore.Count <= 0) { return; } var numberOfPages = (InternalStore.Count / CommitBatchSize) + (InternalStore.Count % CommitBatchSize == 0 ? 0 : 1); for (var pageIndex = 0; pageIndex < numberOfPages; pageIndex++) { var dt = InternalStore.Skip(pageIndex * CommitBatchSize).Take(CommitBatchSize).ToDataTable(); BulkInsert(dt); } }
public virtual async Task <ResponseData> GetViewModal(int id, string name) { try { name = name.ToLower(); var model = InternalStore.Modals.FirstOrDefault(m => m.Name == name && m.Actions.Contains((RepositoryRule.Enums.Actions)id)); if (model == null) { return(GetProps(name)); } var tip = _types.FirstOrDefault(m => m.Key.ToLower() == name); return(this.GetResponse(InternalStore.ParseModalProps(model, tip.Value))); } catch (Exception ext) { return(this.GetResponse(ext)); } }
private bool Add(string key, Entity entity) { return(InternalStore.TryAdd(key, entity)); }
/// <summary> /// Determines whether the assumption type is contained. /// </summary> /// <param name="assumption">The assumption.</param> /// <returns></returns> public bool Contains(EntityDataAssumptionBaseAttribute assumption) { return(InternalStore.ContainsKey(GetKey(assumption))); }
/// <summary> /// Determines whether the assumption type is contained. /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public bool Contains <T>() where T : EntityDataAssumptionBaseAttribute { return(InternalStore.ContainsKey(GetKey <T>())); }