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


C# IEntity.PreStore方法代码示例

本文整理汇总了C#中IEntity.PreStore方法的典型用法代码示例。如果您正苦于以下问题:C# IEntity.PreStore方法的具体用法?C# IEntity.PreStore怎么用?C# IEntity.PreStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEntity的用法示例。


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

示例1: PreSave

        /// <summary>
        /// Prepares the provided entity for saving.
        /// </summary>
        /// <param name="entity">The entity to prepare for saving.</param>
        /// <param name="handleReferences">A value indicating whether to delete old references and save new references.</param>
        public override void PreSave(IEntity entity, bool handleReferences)
        {
            using (LogGroup logGroup = LogGroup.StartDebug("Preparing entity for saving: " + entity.GetType().ToString()))
            {
                if (entity == null)
                    throw new ArgumentNullException("entity");

                entity.PreStore();

                // If the entity is NOT a reference object (ie. it's a standard entity)
                // then prepare the save.
                // If is IS a reference object the preparation is not needed and should be skipped
                if (!(entity is EntityReference))
                {
                    Type entityType = entity.GetType();

                    LogWriter.Debug("Entity type: " + entityType.ToString());

                    if (handleReferences)
                    {
                        // Maintain the entity references
                        Provider.Referencer.MaintainReferences(entity);
                    }

                    LogWriter.Debug("Presave complete.");
                }
            }
        }
开发者ID:jeremysimmons,项目名称:sitestarter,代码行数:33,代码来源:Db4oDataSaver.cs

示例2: PreUpdate

        /// <summary>
        /// Prepares the provided entity to be updated and handles references.
        /// </summary>
        /// <param name="entity">The entity to be prepared for update.</param>
        public override void PreUpdate(IEntity entity)
        {
            using (LogGroup logGroup = LogGroup.Start("Preparing entity to be updated.", NLog.LogLevel.Debug))
            {
                if (entity == null)
                    throw new ArgumentNullException("entity");

                LogWriter.Debug("Entity type: " + entity.GetType().ToString());
                LogWriter.Debug("Entity ID : " + entity.ID);

                entity.PreStore();

                // If the entity is NOT a reference object (ie. it's a standard entity)
                // then prepare the update.
                // If it IS a reference object the preparation is not needed and should be skipped
                if (!(entity is EntityReference))
                {
                    Provider.Referencer.MaintainReferences(entity);
                }
            }
        }
开发者ID:jeremysimmons,项目名称:sitestarter,代码行数:25,代码来源:Db4oDataUpdater.cs


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