GetEntityPersister() public method

public GetEntityPersister ( string entityName ) : IEntityPersister
entityName string
return IEntityPersister
        public void SetUp()
        {
            var assemblyContainingSagas = typeof(TestSaga).Assembly;

            var builder = new SessionFactoryBuilder(assemblyContainingSagas.GetTypes());

            sessionFactory = builder.Build(SQLiteConfiguration.Standard
             .InMemory()
             .ProxyFactoryFactory(typeof(ProxyFactoryFactory).AssemblyQualifiedName)
             .ToProperties(), false) as SessionFactoryImpl;

            persisterForTestSaga = sessionFactory.GetEntityPersister(typeof(TestSaga).FullName);

            persisterForTestSaga.ShouldNotBeNull();
        }
Example #2
0
 /// <summary>
 /// Find a join.  Return the name of the corresponding property.
 /// </summary>
 private static AbstractEntityPersister FindJoinedEntity(SessionFactoryImpl sf, AbstractEntityPersister root, string toTable, string fromField, out string propertyName)
 {
     //   root.ClassMetadata.PropertyTypes.First().Na
     for (int i = 0; i < root.PropertyTypes.Length; i++)
     {
         if (root.PropertyTypes[i].IsAssociationType &&
             !root.PropertyTypes[i].IsCollectionType)
         {
             String[] cols = root.ToColumns(root.PropertyNames[i]);
             if (cols.Length == 1 && cols[0] == fromField)
             {
                 propertyName = root.PropertyNames[i];
                 Type t = root.PropertyTypes[i].ReturnedClass;
                 String entityName = sf.TryGetGuessEntityName(t);
                 AbstractEntityPersister persister = (AbstractEntityPersister)sf.GetEntityPersister(entityName);
                 if (persister.TableName == toTable)
                     return persister;
                 // special case for acct mgr
                 if (toTable == "USERINFO" && persister.TableName == "USERSECURITY")
                 {
                     propertyName = propertyName + ".UserInfo";
                     entityName = "Sage.SalesLogix.Security.UserInfo";
                     return (AbstractEntityPersister)sf.GetEntityPersister(entityName);
                 }
             }
         }
     }
     propertyName = null;
     return null;
 }