コード例 #1
0
		public CustomCollectionType(System.Type userTypeClass, string role, string foreignKeyPropertyName, bool isEmbeddedInXML)
			: base(role, foreignKeyPropertyName, isEmbeddedInXML)
		{
			if (!typeof(IUserCollectionType).IsAssignableFrom(userTypeClass))
			{
				throw new MappingException("Custom type does not implement UserCollectionType: " + userTypeClass.FullName);
			}

			try
			{
				userType = (IUserCollectionType) Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(userTypeClass);
			}
			catch (InstantiationException ie)
			{
				throw new MappingException("Cannot instantiate custom type: " + userTypeClass.FullName, ie);
			}
			catch (MemberAccessException mae)
			{
				throw new MappingException("MemberAccessException trying to instantiate custom type: " + userTypeClass.FullName, mae);
			}
		}
コード例 #2
0
        public CustomCollectionType(System.Type userTypeClass, string role, string foreignKeyPropertyName)
            : base(role, foreignKeyPropertyName)
        {
            if (!typeof(IUserCollectionType).IsAssignableFrom(userTypeClass))
            {
                throw new MappingException("Custom type does not implement UserCollectionType: " + userTypeClass.FullName);
            }

            try
            {
                userType = (IUserCollectionType)Cfg.Environment.ObjectsFactory.CreateInstance(userTypeClass);
            }
            catch (InstantiationException ie)
            {
                throw new MappingException("Cannot instantiate custom type: " + userTypeClass.FullName, ie);
            }
            catch (MemberAccessException mae)
            {
                throw new MappingException("MemberAccessException trying to instantiate custom type: " + userTypeClass.FullName, mae);
            }
        }