public static InjectParameters ( Object type, string>.IDictionary |
||
type | Object | |
parameters | string>.IDictionary | |
Результат | void |
public CustomType(System.Type userTypeClass, IDictionary <string, string> parameters) { name = userTypeClass.Name; try { userType = (IUserType)Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(userTypeClass); } catch (ArgumentNullException ane) { throw new MappingException("Argument is a null reference.", ane); } catch (ArgumentException ae) { throw new MappingException("Argument " + userTypeClass.Name + " is not a RuntimeType", ae); } catch (TargetInvocationException tie) { throw new MappingException("The constructor being called throws an exception.", tie); } catch (MethodAccessException mae) { throw new MappingException("The caller does not have permission to call this constructor.", mae); } catch (MissingMethodException mme) { throw new MappingException("No matching constructor was found.", mme); } catch (InvalidCastException ice) { throw new MappingException(userTypeClass.Name + " must implement NHibernate.UserTypes.IUserType", ice); } TypeFactory.InjectParameters(userType, parameters); sqlTypes = userType.SqlTypes; }
public CompositeCustomType(System.Type userTypeClass, IDictionary <string, string> parameters) { name = userTypeClass.FullName; try { userType = (ICompositeUserType)Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(userTypeClass); } catch (MethodAccessException mae) { throw new MappingException("MethodAccessException trying to instantiate custom type: " + name, mae); } catch (TargetInvocationException tie) { throw new MappingException("TargetInvocationException trying to instantiate custom type: " + name, tie); } catch (ArgumentException ae) { throw new MappingException("ArgumentException trying to instantiate custom type: " + name, ae); } catch (InvalidCastException ice) { throw new MappingException(name + " must implement NHibernate.UserTypes.ICompositeUserType", ice); } TypeFactory.InjectParameters(userType, parameters); if (!userType.ReturnedClass.IsSerializable) { LogManager.GetLogger(typeof(CustomType)).Warn("custom type is not Serializable: " + userTypeClass); } }
public CompositeCustomType(System.Type userTypeClass, IDictionary <string, string> parameters) { name = userTypeClass.FullName; try { userType = (ICompositeUserType)Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(userTypeClass); } catch (MethodAccessException mae) { throw new MappingException("MethodAccessException trying to instantiate custom type: " + name, mae); } catch (TargetInvocationException tie) { throw new MappingException("TargetInvocationException trying to instantiate custom type: " + name, tie); } catch (ArgumentException ae) { throw new MappingException("ArgumentException trying to instantiate custom type: " + name, ae); } catch (InvalidCastException ice) { throw new MappingException(name + " must implement NHibernate.UserTypes.ICompositeUserType", ice); } TypeFactory.InjectParameters(userType, parameters); if (!userType.ReturnedClass.IsSerializable) { LoggerProvider.LoggerFor(typeof(CustomType)).WarnFormat("the custom composite class '{0}' handled by '{1}' is not Serializable: ", userType.ReturnedClass, userTypeClass); } // This is to be nice to an application developer. if (userType.PropertyTypes == null) { throw new InvalidOperationException(String.Format("ICompositeUserType {0} returned a null value for 'PropertyTypes'.", userType.GetType())); } if (userType.PropertyNames == null) { throw new InvalidOperationException(String.Format("ICompositeUserType {0} returned a null value for 'PropertyNames'.", userType.GetType())); } }