/// <summary> /// Initializes a new instance of the <see cref="FlightVersionHistory"/> class. /// </summary> /// <param name="flight"> /// The flight. /// </param> /// <param name="entityState"> /// The entity state. /// </param> public FlightVersionHistory(Flight f, EntityState entityState) { this.State = entityState.ToString(); this.FlightId = f.FlightId; this.Created = DateTime.Now; this.Deleted = f.Deleted; this.LastUpdated = f.LastUpdated; this.LastUpdatedBy = f.LastUpdatedBy; this.Description = f.Description; this.Date = f.Date; this.Departure = f.Departure; this.Landing = f.Landing; this.LandingCount = f.LandingCount; this.PlaneId = f.PlaneId; this.PilotId = f.PilotId; this.PilotBackseatId = f.PilotBackseatId; this.BetalerId = f.BetalerId; this.StartTypeId = f.StartTypeId; this.StartedFromId = f.StartedFromId; this.LandedOnId = f.LandedOnId; this.TachoDeparture = f.TachoDeparture; this.TachoLanding = f.TachoLanding; }
/// <summary> /// Initializes a new instance of the <see cref="HookEntityMetadata" /> class. /// </summary> /// <param name="hookType"></param> /// <param name="entry"></param> /// <param name="state">The state.</param> /// <param name="context">The optional existing context (I believe this is usable for migrations).</param> public HookEntityMetadata(HookType hookType, HookedEntityEntry entry, EntityState state, System.Data.Entity.DbContext context = null) { HookType = hookType; Entry = entry; _state = state; CurrentContext = context; }
public Cursor(EntityState es, Town t, XmlParser xp) : base(es, "Cursor") { _town = t; //Current data path is GameState->Town->Cursor var path = es.Name + "->" + _town.Name + "->" + Name; Body = new Body(this, "Body"); AddComponent(Body); Physics = new Physics(this, "Physics"); AddComponent(Physics); ImageRender = new ImageRender(this, "ImageRender"); AddComponent(ImageRender); _aimleftkey = new DoubleInput(this, "AimLeftKey", Keys.A, Buttons.DPadLeft, PlayerIndex.One); AddComponent(_aimleftkey); _aimrightkey = new DoubleInput(this, "AimRightKeys", Keys.D, Buttons.DPadRight, PlayerIndex.One); AddComponent(_aimrightkey); _quickaimkey = new DoubleInput(this, "QuickAimKey", Keys.LeftShift, Buttons.RightShoulder, PlayerIndex.One); AddComponent(_quickaimkey); ParseXml(xp, path); ImageRender.Origin = new Vector2(ImageRender.Texture.Width / 2f, ImageRender.Texture.Height / 2f); Body.Position = _town.Body.Position + (_town.TileRender.Origin - Vector2.UnitY * 40 - ImageRender.Origin) * ImageRender.Scale; }
private static IEnumerable<AuditLog> GetAuditLogs(EntityEntry entityEntry, string userName, EntityState entityState) { var returnValue = new List<AuditLog>(); var keyRepresentation = BuildKeyRepresentation(entityEntry, KeySeperator); var auditedPropertyNames = entityEntry.Entity.GetType() .GetProperties().Where(p => !p.GetCustomAttributes(typeof (DoNotAudit), true).Any()) .Select(info => info.Name); foreach (var propertyEntry in entityEntry.Metadata.GetProperties() .Where(x => auditedPropertyNames.Contains(x.Name)) .Select(property => entityEntry.Property(property.Name))) { if(entityState == EntityState.Modified) if (Convert.ToString(propertyEntry.OriginalValue) == Convert.ToString(propertyEntry.CurrentValue)) //Values are the same, don't log continue; returnValue.Add(new AuditLog { KeyNames = keyRepresentation.Key, KeyValues = keyRepresentation.Value, OriginalValue = entityState != EntityState.Added ? Convert.ToString(propertyEntry.OriginalValue) : null, NewValue = entityState == EntityState.Modified || entityState == EntityState.Added ? Convert.ToString(propertyEntry.CurrentValue) : null, ColumnName = propertyEntry.Metadata.Name, EventDateTime = DateTime.Now, EventType = entityState.ToString(), UserName = userName, TableName = entityEntry.Entity.GetType().Name }); } return returnValue; }
public void SetStateForSlot(ISlot slot, EntityState modified) { Slot instance = ConvertToSlot(slot); Entry(instance).State = EntityState.Modified; }
public virtual void StateChanging([NotNull] StateEntry entry, EntityState newState) { Check.NotNull(entry, "entry"); Check.IsDefined(newState, "newState"); Dispatch(l => l.StateChanging(entry, newState)); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual void AttachGraph(InternalEntityEntry rootEntry, EntityState entityState) => _graphIterator.TraverseGraph( new EntityEntryGraphNode(rootEntry, null) { NodeState = entityState }, PaintAction);
internal ValuePair(Func<object> originalValue, Func<object> newValue, string propertyName, EntityState state) { this.originalValue = checkDbNull(originalValue); this.newValue = checkDbNull(newValue); this.propertyName = propertyName; this.state = state; }
private IEnumerable<object> GetChangeTrackersEntries(EntityState state) { return from entry in this.databaseContext.ChangeTracker.Entries() where entry.State == state select entry.Entity; }
public void Add_dependent_then_principal_one_to_many_FK_set_both_navs_set(EntityState entityState) { using (var context = new FixupContext()) { var principal = new Category { Id = 77 }; var dependent = new Product { Id = 78, Category = principal }; principal.Products.Add(dependent); context.Entry(dependent).Property("CategoryId").CurrentValue = principal.Id; context.Entry(dependent).State = entityState; context.Entry(principal).State = entityState; AssertFixup( context, () => { Assert.Equal(principal.Id, context.Entry(dependent).Property("CategoryId").CurrentValue); Assert.Same(principal, dependent.Category); Assert.Equal(new[] { dependent }.ToList(), principal.Products); Assert.Equal(entityState, context.Entry(principal).State); Assert.Equal(entityState, context.Entry(dependent).State); }); } }
public virtual void StateChanged([NotNull] StateEntry entry, EntityState oldState) { Check.NotNull(entry, "entry"); Check.IsDefined(oldState, "oldState"); Dispatch(l => l.StateChanged(entry, oldState)); }
/// <summary> /// Initializes a new instance of the <see cref="NowRule"/> class. /// </summary> /// <param name="property">The property.</param> /// <param name="assignState">State of the object that can be assigned.</param> /// <param name="timeZone">The time zone.</param> public NowRule(string property, EntityState assignState, NowTimeZone timeZone) : base(property, assignState) { // lower priority because we need to assign before validate Priority = 10; TimeZone = timeZone; }
public void SetStateForSlot(IDay day, EntityState modified) { Day instance = ConvertToDay(day); Entry(instance).State = EntityState.Modified; }
internal ExtractedStateEntry(EntityState state, PropagatorResult original, PropagatorResult current, IEntityStateEntry source) { State = state; Original = original; Current = current; Source = source; }
private static IEnumerable<AuditLog> GetAuditLogs(DbEntityEntry entityEntry, string userName, EntityState entityState, ObjectContext objectContext, DateTime auditDateTime) { var returnValue = new List<AuditLog>(); var keyRepresentation = BuildKeyRepresentation(entityEntry, KeySeperator, objectContext); var auditedPropertyNames = GetDeclaredPropertyNames(entityEntry.Entity.GetType(), objectContext.MetadataWorkspace); foreach (var propertyName in auditedPropertyNames) { var currentValue = Convert.ToString(entityEntry.CurrentValues.GetValue<object>(propertyName)); var originalValue = Convert.ToString(entityEntry.GetDatabaseValues().GetValue<object>(propertyName)); if (entityState == EntityState.Modified) if (originalValue == currentValue) //Values are the same, don't log continue; returnValue.Add(new AuditLog { KeyNames = keyRepresentation.Key, KeyValues = keyRepresentation.Value, OriginalValue = entityState != EntityState.Added ? originalValue : null, NewValue = entityState == EntityState.Modified || entityState == EntityState.Added ? currentValue : null, ColumnName = propertyName, EventDateTime = auditDateTime, EventType = entityState.ToString(), UserName = userName, TableName = entityEntry.Entity.GetType().Name }); } return returnValue; }
public EntityTool() { Usage = ToolUsage.Both; _location = new Coordinate(0, 0, 0); _state = EntityState.None; _sidebarPanel = new EntitySidebarPanel(); }
public EntityAI(Vector2 objectPosition, float objectradius, float objectSpeed) { m_CurrentState = EntityState.PrimaryObjective; m_ObjectPosition = Vector2.Zero; m_ObjectRangeRadius = objectradius; m_ObjectSpeed = objectSpeed; m_MeetsTarget = false; }
void EntitySetState(EntityBase ent, EntityState state) { switch(state) { case EntityState.dying: ClearSummonQueue(); break; } }
public static string GetEntityEventName(EntityState state, IEntityNotifyChanged entity) { EntityEvent.EntityEventType eventType = GetEntityEventType(state); Type entityType = entity.GetType(); Int64 entityId = entity.GetID(); string eventObjTag = $"EntityEvents.{entityType.Name}.{eventType}.{entityId}"; return eventObjTag; }
/// <summary> /// Actual initialization constructor. /// </summary> /// <param name="position"></param> /// <param name="imgLoc"></param> public Entity(Vector2 direction, string imgLoc) : base(imgLoc) { this.direction = direction; state = EntityState.IDLE; Name = "Entity-" + ThisID; Health = 10; }
// ObjectStateEntry will not be detached and creation will be handled from ObjectStateManager internal ObjectStateEntry(ObjectStateManager cache, EntitySet entitySet, EntityState state) { //Contract.Requires(cache != null); _cache = cache; _entitySet = entitySet; _state = state; }
// ObjectStateEntry will not be detached and creation will be handled from ObjectStateManager internal ObjectStateEntry(ObjectStateManager cache, EntitySet entitySet, EntityState state) { DebugCheck.NotNull(cache); _cache = cache; _entitySet = entitySet; _state = state; }
// ObjectStateEntry will not be detached and creation will be handled from ObjectStateManager internal ObjectStateEntry(ObjectStateManager cache, EntitySet entitySet, EntityState state) { Debug.Assert(cache != null, "cache cannot be null."); _cache = cache; _entitySet = entitySet; _state = state; }
/// <summary> /// Actual initialization constructor. /// </summary> /// <param name="position"></param> /// <param name="imgLoc"></param> public Creature(string imgLoc) : base(imgLoc) { iEntityState = EntityState.IDLE; Name = "Entity-" + ThisID; Health = 10; Strength = 10; }
public PositionEntity(int id, Position position, EntityType type, Direction orientation, int pokedexId, EntityState state) { Id = id; Position = position; Type = type; Orientation = orientation; PokedexId = pokedexId; State = state; }
/// <summary> /// Initializes a new instance of the <see cref="ConnectionRequestChangeTransaction"/> class. /// </summary> /// <param name="entry">The entry.</param> public ConnectionRequestChangeTransaction( DbEntityEntry entry ) { // If entity was a connection request, save the values var connectionRequest = entry.Entity as ConnectionRequest; if ( connectionRequest != null ) { State = entry.State; // If this isn't a deleted connection request, get the connection request guid if ( State != EntityState.Deleted ) { ConnectionRequestGuid = connectionRequest.Guid; PersonId = connectionRequest.PersonAlias != null ? connectionRequest.PersonAlias.PersonId : (int?)null; if ( connectionRequest.ConnectionOpportunity != null ) { ConnectionTypeId = connectionRequest.ConnectionOpportunity.ConnectionTypeId; } ConnectionOpportunityId = connectionRequest.ConnectionOpportunityId; ConnectorPersonAliasId = connectionRequest.ConnectorPersonAliasId; ConnectionState = connectionRequest.ConnectionState; ConnectionStatusId = connectionRequest.ConnectionStatusId; AssignedGroupId = connectionRequest.AssignedGroupId; if ( State == EntityState.Modified ) { var dbOpportunityIdProperty = entry.Property( "ConnectionOpportunityId" ); if ( dbOpportunityIdProperty != null ) { PreviousConnectionOpportunityId = dbOpportunityIdProperty.OriginalValue as int?; } var dbConnectorPersonAliasIdProperty = entry.Property( "ConnectorPersonAliasId" ); if ( dbConnectorPersonAliasIdProperty != null ) { PreviousConnectorPersonAliasId = dbConnectorPersonAliasIdProperty.OriginalValue as int?; } var dbStateProperty = entry.Property( "ConnectionState" ); if ( dbStateProperty != null ) { PreviousConnectionState = (ConnectionState)dbStateProperty.OriginalValue; } var dbStatusProperty = entry.Property( "ConnectionStatusId" ); if ( dbStatusProperty != null ) { PreviousConnectionStatusId = (int)dbStatusProperty.OriginalValue; } var dbAssignedGroupIdProperty = entry.Property( "AssignedGroupId" ); if ( dbAssignedGroupIdProperty != null ) { PreviousAssignedGroupId = dbAssignedGroupIdProperty.OriginalValue as int?; } } } } }
public static EntityEvent CreateEntityEvent(EntityState state, IEntityNotifyChanged entity) { EntityEvent.EntityEventType eventType = GetEntityEventType(state); Type entityType = entity.GetType(); Int64 entityId = entity.GetID(); List<RealtimeDashboard.Database.Models.RelatedEntityInfo> relatedEntityInfo = entity.GetRelatedEntityInfo(); EntityEvent entityEvent = ServiceBusProtocolUtils.CreatEntityEvent(entityId, entityType.Name, eventType, relatedEntityInfo); return entityEvent; }
public static EntityState MoveTowards(EntityState sourceState, EntityState targetState, float maxDistance, float maxAngle) { return new EntityState { position = Vector3.MoveTowards(sourceState.position, targetState.position, maxDistance), rotation = Quaternion.RotateTowards(sourceState.rotation, targetState.rotation, maxAngle), force = Vector3.MoveTowards(sourceState.force, targetState.force, maxDistance), }; }
/// <summary> /// Initializes a new instance of the <see cref="EntityBag" /> class. /// </summary> /// <param name="clientEntity">The entity before serialization.</param> /// <param name="entity">The entity.</param> /// <param name="entityState">State of the entity.</param> /// <param name="originalValues">The original values.</param> /// <param name="index">The index in the client array.</param> /// <param name="forceUpdate">if set to <c>true</c> [force update].</param> public EntityBag(object clientEntity, object entity, EntityState entityState, IDictionary<string, object> originalValues, int index, bool? forceUpdate = null) { _clientEntity = clientEntity; _entity = entity; _entityState = entityState; _originalValues = originalValues ?? new Dictionary<string, object>(); _index = index; ForceUpdate = forceUpdate == true; }
public static EntityState Lerp(EntityState sourceState, EntityState targetState, float t) { return new EntityState { position = Vector3.Lerp(sourceState.position, targetState.position, t), force = Vector3.Lerp(sourceState.force, targetState.force, t), rotation = Quaternion.Lerp(sourceState.rotation, targetState.rotation, t) }; }
/// <summary> /// Whether this Entity is unchanged. /// </summary> public static bool IsUnchanged(this EntityState es) { return((es & EntityState.Unchanged) > 0); }
public override async Task Load_one_to_one_PK_to_PK_reference_to_principal_using_Query_already_loaded(EntityState state, bool async) { await base.Load_one_to_one_PK_to_PK_reference_to_principal_using_Query_already_loaded(state, async); if (!async) { Assert.Equal( @"@__get_Item_0='707' SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); } }
public override async Task Load_one_to_one_reference_to_dependent_already_loaded_untyped(EntityState state, bool async) { await base.Load_one_to_one_reference_to_dependent_already_loaded_untyped(state, async); if (!async) { Assert.Equal("", Sql); } }
public override async Task Load_one_to_one_reference_to_dependent_using_Query_already_loaded_untyped(EntityState state, bool async) { await base.Load_one_to_one_reference_to_dependent_using_Query_already_loaded_untyped(state, async); if (!async) { Assert.Equal( @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Single] AS [e] WHERE [e].[ParentId] = @__get_Item_0", Sql); } }
public override async Task Load_many_to_one_reference_to_principal_using_Query_alternate_key(EntityState state, bool async) { await base.Load_many_to_one_reference_to_principal_using_Query_alternate_key(state, async); if (!async) { Assert.Equal( @"@__get_Item_0='Root' (Nullable = false) (Size = 4) SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[AlternateId] = @__get_Item_0", Sql); } }
void IEntity.ResetUnchanged() { state = EntityState.Unchanged; valueEntry.Reset(); }
/// <summary> /// Whether this Entity has been either deleted or detached. /// </summary> public static bool IsDeletedOrDetached(this EntityState es) { return((es & (EntityState.Deleted | EntityState.Detached)) > 0); }
/// <summary> /// Whether this Entity has been detached (either not yet attached or removed via RemoveFromManager). /// </summary> public static bool IsDetached(this EntityState es) { return(es == 0 || (es & EntityState.Detached) > 0); }
/// <summary> /// Gets the entity key updated. /// </summary> /// <param name="context">The context.</param> /// <param name="entry">The entry.</param> /// <param name="state">The state.</param> /// <param name="entitySetName">Name of the entity set.</param> /// <returns>returns key</returns> private string GetEntityKeyUpdated(ObjectContext context, DbEntityEntry entry, EntityState state, out string entitySetName) { var keyBuilder = new StringBuilder(); ObjectStateEntry newEntry = null; if (!context.ObjectStateManager.TryGetObjectStateEntry(entry.Entity, out newEntry)) { entitySetName = String.Empty; Trace.TraceInformation("Can't find state entry for \"{0}\"", entry.ToString()); return(null); } entitySetName = newEntry.EntitySet.Name; var keys = state == EntityState.Added ? context.CreateEntityKey(newEntry.EntitySet.Name, entry.Entity) : newEntry.EntityKey; foreach (var key in keys.EntityKeyValues) { if (keyBuilder.Length > 0) { keyBuilder.Append(","); } keyBuilder.Append(Convert.ToString(key.Value)); } return(keyBuilder.ToString()); }
/// <summary> /// Whether this Entity has been deleted (but the change has not yet been persisted to the data source). /// </summary> public static bool IsDeleted(this EntityState es) { return((es & EntityState.Deleted) > 0); }
public FormButtonDTO() { this.ObjectState = EntityState.New; }
//public string Log() //{ // var logString = CustomerId + ": " + // FullName + " " + // "Email: " + EmailAdress + " " + // "Status: " + EntityState.ToString(); // return logString; //} // Same above public string Log() => $"{CustomerId}: {FullName} Email: {EmailAdress} Status: {EntityState.ToString()}";
protected virtual void SetEntityState(object entity, EntityState entityState) { this.Context.Entry(entity).State = entityState; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual void StateChanging(InternalEntityEntry entry, EntityState newState) { }
/// <summary> /// States the entry2 operation log. /// </summary> /// <param name="entitySet">The entity set.</param> /// <param name="objectType">Type of the object.</param> /// <param name="now">The now.</param> /// <param name="keyValue">The key value.</param> /// <param name="state">The state.</param> /// <returns> /// OperationLog object /// </returns> private OperationLog StateEntry2OperationLog(string entitySet, string objectType, DateTime now, string keyValue, EntityState state) { var userName = Thread.CurrentPrincipal.Identity.Name; if (String.IsNullOrEmpty(userName)) { userName = "******"; } var retVal = new OperationLog { LastModified = now, ObjectId = keyValue, ObjectType = objectType, TableName = entitySet, ModifiedBy = userName, OperationType = state.ToString() }; return(retVal); }
// JJT - not sure if this makes sense. ///// <summary> ///// Whether this entity has been changed ( added, deleted, detached) ///// </summary> ///// <param name="es"></param> ///// <returns></returns> //public static bool IsChanged(this EntityState es) { // return !IsUnchanged(es); //} /// <summary> /// Whether this Entity has been added. /// </summary> public static bool IsAdded(this EntityState es) { return((es & EntityState.Added) > 0); }
/// <summary> /// Updates any Cache Objects that are associated with this entity /// </summary> /// <param name="entityState">State of the entity.</param> /// <param name="dbContext">The database context.</param> public void UpdateCache(EntityState entityState, Rock.Data.DbContext dbContext) { DefinedValueCache.UpdateCachedEntity(this.Id, entityState); DefinedTypeCache.FlushItem(this.DefinedTypeId); }
public Post(Blog blog, string body, string bodyShort, bool commentingDisabled, DateTime created, UserAuthenticated creator, Guid id, DateTime modified, DateTime?published, string slug, EntityState state, IEnumerable <PostTag> tags, string title, IEnumerable <PostComment> comments, IEnumerable <Trackback> trackbacks, IEnumerable <File> files) : this(id) { Blog = blog; Body = body; BodyShort = bodyShort; CommentingDisabled = commentingDisabled; Creator = creator; Published = published; Slug = slug; State = state; Tags = tags; Title = title; Created = created; Comments = comments; Modified = modified; Trackbacks = trackbacks; Files = files; }
/// <summary> /// 初始化 <see cref="T:Fireasy.Data.Entity.EntityObject"/> 类的新实例。对象的初始状态为 Attached。 /// </summary> protected EntityObject() { entityType = GetEntityType(); state = EntityState.Attached; lazyMgr = new EntityLzayManager(entityType); }
public Post(Blog blog, string body, string bodyShort, bool commentingDisabled, UserAuthenticated creator, DateTime?published, string slug, EntityState state, IEnumerable <PostTag> tags, string title) { Blog = blog; Body = body; BodyShort = bodyShort; CommentingDisabled = commentingDisabled; Creator = creator; Published = published; Slug = slug; State = state; Tags = tags; Title = title; }
void IEntity.SetState(EntityState state) { this.state = state; }
public virtual async Task AfterSave(EntityState operation, LactalisDBContext dbContext, IServiceProvider serviceProvider, ICollection <ChangeState> changes, CancellationToken cancellationToken = default) { }
public override async Task Load_one_to_one_reference_to_dependent_alternate_key(EntityState state, bool async) { await base.Load_one_to_one_reference_to_dependent_alternate_key(state, async); if (!async) { Assert.Equal( @"@__get_Item_0='Root' (Nullable = false) (Size = 4) SELECT [e].[Id], [e].[ParentId] FROM [SingleAk] AS [e] WHERE [e].[ParentId] = @__get_Item_0", Sql); } }
public virtual async Task BeforeSave(EntityState operation, LactalisDBContext dbContext, IServiceProvider serviceProvider, CancellationToken cancellationToken = default) { }
public override async Task Load_collection_using_Query_already_loaded_untyped(EntityState state, bool async) { await base.Load_collection_using_Query_already_loaded_untyped(state, async); if (!async) { Assert.Equal( @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] WHERE [e].[ParentId] = @__get_Item_0", Sql); } }
public string Log() => $"{OrderId}: Date:{OrderDate}, Status:{EntityState.ToString()}";
public override async Task Load_one_to_one_reference_to_principal_using_Query_not_found_untyped(EntityState state, bool async) { await base.Load_one_to_one_reference_to_principal_using_Query_not_found_untyped(state, async); if (!async) { Assert.Equal( @"@__get_Item_0='787' SELECT [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); } }
public void UpdateState <TEntity>(TEntity entity, EntityState state) { _context.Entry(entity).State = state; }
/// <summary> /// Whether this Entity has been modified. /// </summary> public static bool IsModified(this EntityState es) { return((es & EntityState.Modified) > 0); }
/// <summary> /// Whether this Entity has been either deleted or modified /// </summary> public static bool IsDeletedOrModified(this EntityState es) { return((es & (EntityState.Deleted | EntityState.Modified)) > 0); }