/// <summary>
        /// Loads the specified entity into this context.
        /// </summary>
        public Entity Load(EntityRef entityRef, EntityLoadFlags flags)
        {
            try
            {
                // use a proxy if EntityLoadFlags.Proxy is specified and EntityLoadFlags.CheckVersion is not specified (CheckVersion overrides Proxy)
                var useProxy = (flags & EntityLoadFlags.CheckVersion) == 0 && (flags & EntityLoadFlags.Proxy) == EntityLoadFlags.Proxy;
                var entity   = (Entity)Load(EntityRefUtils.GetClass(entityRef), EntityRefUtils.GetOID(entityRef), useProxy);

                // check version if necessary
                if ((flags & EntityLoadFlags.CheckVersion) == EntityLoadFlags.CheckVersion && !EntityRefUtils.GetVersion(entityRef).Equals(entity.Version))
                {
                    throw new EntityVersionException(EntityRefUtils.GetOID(entityRef), null);
                }

                return(entity);
            }
            catch (ObjectNotFoundException hibernateException)
            {
                // note that we will only get here if useProxy == false in the above block
                // if the entity is proxied, verification of its existence is deferred until the proxy is realized
                throw new EntityNotFoundException(hibernateException);
            }
        }
Example #2
0
 public TEntity Load <TEntity>(EntityRef entityRef, EntityLoadFlags flags) where TEntity : Entity
 {
     throw new Exception("The method or operation is not implemented.");
 }
Example #3
0
 public Entity Load(EntityRef entityRef, EntityLoadFlags flags)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 /// <summary>
 /// Loads the specified entity into this context using the specified load flags.
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <param name="entityRef"></param>
 /// <param name="flags"></param>
 /// <returns></returns>
 public TEntity Load <TEntity>(EntityRef entityRef, EntityLoadFlags flags)
     where TEntity : Entity
 {
     return((TEntity)Load(entityRef, flags));
 }
Example #5
0
 public TEntity Load(EntityRef entityRef, EntityLoadFlags flags)
 {
     return(this.Context.Load <TEntity>(entityRef, flags));
 }