当前位置: 首页>>代码示例>>C#>>正文


C# EntityState类代码示例

本文整理汇总了C#中EntityState的典型用法代码示例。如果您正苦于以下问题:C# EntityState类的具体用法?C# EntityState怎么用?C# EntityState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EntityState类属于命名空间,在下文中一共展示了EntityState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValuePair

 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;
 }
开发者ID:NiSHoW,项目名称:FrameLogCustom,代码行数:7,代码来源:ValuePair.cs

示例2: Cursor

        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;
        }
开发者ID:redcodefinal,项目名称:SuperTownDefensev2,代码行数:33,代码来源:Cursor.cs

示例3: StateChanged

        public virtual void StateChanged([NotNull] StateEntry entry, EntityState oldState)
        {
            Check.NotNull(entry, "entry");
            Check.IsDefined(oldState, "oldState");

            Dispatch(l => l.StateChanged(entry, oldState));
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:7,代码来源:StateEntryNotifier.cs

示例4: StateChanging

        public virtual void StateChanging([NotNull] StateEntry entry, EntityState newState)
        {
            Check.NotNull(entry, "entry");
            Check.IsDefined(newState, "newState");

            Dispatch(l => l.StateChanging(entry, newState));
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:7,代码来源:StateEntryNotifier.cs

示例5: GetAuditLogs

        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;
        }
开发者ID:johannbrink,项目名称:EF6Auditing,代码行数:33,代码来源:AuditLogBuilder.cs

示例6: EntityTool

 public EntityTool()
 {
     Usage = ToolUsage.Both;
     _location = new Coordinate(0, 0, 0);
     _state = EntityState.None;
     _sidebarPanel = new EntitySidebarPanel();
 }
开发者ID:silky,项目名称:sledge,代码行数:7,代码来源:EntityTool.cs

示例7: SetStateForSlot

        public void SetStateForSlot(IDay day,
                                    EntityState modified)
        {
            Day instance = ConvertToDay(day);

            Entry(instance).State = EntityState.Modified;
        }
开发者ID:tschroedter,项目名称:DoctorsAppointment,代码行数:7,代码来源:DaysContext.cs

示例8: NowRule

 /// <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;
 }
开发者ID:codesmithtools,项目名称:CodeSmith.Data,代码行数:13,代码来源:NowRule.cs

示例9: GetChangeTrackersEntries

 private IEnumerable<object> GetChangeTrackersEntries(EntityState state)
 {
     return
         from entry in this.databaseContext.ChangeTracker.Entries()
         where entry.State == state
         select entry.Entity;
 }
开发者ID:NinjaVault,项目名称:NinjaHive,代码行数:7,代码来源:EntityEditHandler.cs

示例10: HookEntityMetadata

 /// <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;
 }
开发者ID:ComposITDevelop,项目名称:SAM,代码行数:14,代码来源:HookEntityMetadata.cs

示例11: ExtractedStateEntry

 internal ExtractedStateEntry(EntityState state, PropagatorResult original, PropagatorResult current, IEntityStateEntry source)
 {
     State = state;
     Original = original;
     Current = current;
     Source = source;
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:7,代码来源:ExtractedStateEntry.cs

示例12: FlightVersionHistory

        /// <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;
        }
开发者ID:janhebnes,项目名称:startlist.club,代码行数:34,代码来源:FlightVersionHistory.cs

示例13: AttachGraph

 /// <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);
开发者ID:RickyLin,项目名称:EntityFramework,代码行数:11,代码来源:EntityGraphAttacher.cs

示例14: GetAuditLogs

        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;
        }
开发者ID:johannbrink,项目名称:EFAuditing,代码行数:35,代码来源:AuditLogBuilder.cs

示例15: SetStateForSlot

        public void SetStateForSlot(ISlot slot,
                                    EntityState modified)
        {
            Slot instance = ConvertToSlot(slot);

            Entry(instance).State = EntityState.Modified;
        }
开发者ID:tschroedter,项目名称:DoctorsAppointment,代码行数:7,代码来源:SlotsContext.cs


注:本文中的EntityState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。