Пример #1
0
        public object Load(EntityInfo entityInfo)
        {
            object maybeProxy = session.Get(entityInfo.Clazz, entityInfo.Id);
            // TODO: Initialize call and error trapping

            return maybeProxy;
        }
 private EntityInfo Extract(Document document)
 {
     EntityInfo entityInfo = new EntityInfo();
     entityInfo.Clazz = DocumentBuilder.GetDocumentClass(document);
     entityInfo.Id = DocumentBuilder.GetDocumentId(searchFactoryImplementor, entityInfo.Clazz, document);
     if (projection != null && projection.Length > 0)
     {
         entityInfo.Projection = DocumentBuilder.GetDocumentFields(searchFactoryImplementor, entityInfo.Clazz,
                                                                   document, projection);
     }
     return entityInfo;
 }
 private void InitThisProjectionFlag(EntityInfo entityInfo)
 {
     if (projectThis == null)
     {
         projectThis = entityInfo.IndexesOfThis != null;
         if (projectThis == true)
         {
             //TODO use QueryLoader when possible
             objectLoader = new ObjectLoader();
             objectLoader.Init(session, searchFactoryImplementor);
         }
     }
 }
        public object Load(EntityInfo entityInfo)
        {
            InitThisProjectionFlag(entityInfo);
            if (projectThis == true)
            {
                foreach (int index in entityInfo.IndexesOfThis)
                {
                    entityInfo.Projection[index] = objectLoader.Load(entityInfo);
                }
            }

            return transformer != null
                       ? transformer.TransformTuple(entityInfo.Projection, aliases)
                       : entityInfo.Projection;
        }
Пример #5
0
        public object Load(EntityInfo entityInfo)
        {
            object maybeProxy = session.Get(entityInfo.Clazz, entityInfo.Id);
            // TODO: Initialize call and error trapping
            try
            {
                NHibernateUtil.Initialize(maybeProxy);
            }
            catch (Exception e)
            {
                if (LoaderHelper.IsObjectNotFoundException(e))
                {
                    log.Debug("Object found in Search index but not in database: "
                              + entityInfo.Clazz + " wih id " + entityInfo.Id);
                    maybeProxy = null;
                }
                else
                    throw;
            }

            return maybeProxy;
        }