I know this is an old post, but using NHibernateUtil forces one to use a cast to IIdentifierType (or a class implementing IIdentifierType). While the fields in NHibernateUtil are instances of IIdentifierType, they are declared as instances of NullableType on the NHibernateUtil class which means I have to cast them in order to use them with the .Type method.
Is there a new recommended way of doing this? Thanks Wes On Thursday, May 26, 2011 11:21:23 PM UTC+2, Patrick Earl wrote: > > I'd guess .Type(NHibernateUtil.StringClob) should work. > > Patrick Earl > > On Thu, May 26, 2011 at 11:51 AM, Michael Teper > <[email protected] <javascript:>> wrote: > > What is the correct syntax for specifying either StringClob or > > BinaryClob with mapping by code? When I try the seemingly obvious > > "map.Property(x => x.Data, m => m.Type<BinaryBlobType>());", I get an > > exception. I looked through the unit tests in trunk, but didn't find > > any examples. > > > > Any ideas? > > > > The exception is: > > [MissingMethodException: No parameterless constructor defined for this > > object.] > > System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean > > publicOnly, Boolean noCheck, Boolean& canBeCached, > > RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 > > System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean > > skipCheckThis, Boolean fillCache) +98 > > System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, > > Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean > > fillCache) +241 > > System.Activator.CreateInstance(Type type, Boolean nonPublic) +69 > > System.Activator.CreateInstance(Type type) +6 > > NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type > > type) +39 > > NHibernate.Type.TypeFactory.HeuristicType(String typeName, > > IDictionary`2 parameters, Nullable`1 length) +574 > > > > [MappingException: Could not instantiate IType BinaryBlobType: > > System.MissingMethodException: No parameterless constructor defined > > for this object. > > at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, > > Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, > > RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) > > at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, > > Boolean skipCheckThis, Boolean fillCache) > > at System.RuntimeType.CreateInstanceDefaultCtor(Boolean > > publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, > > Boolean fillCache) > > at System.Activator.CreateInstance(Type type, Boolean nonPublic) > > at System.Activator.CreateInstance(Type type) > > at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type > > type) > > at NHibernate.Type.TypeFactory.HeuristicType(String typeName, > > IDictionary`2 parameters, Nullable`1 length)] > > NHibernate.Type.TypeFactory.HeuristicType(String typeName, > > IDictionary`2 parameters, Nullable`1 length) +868 > > NHibernate.Type.TypeFactory.HeuristicType(String typeName, > > IDictionary`2 parameters) +78 > > NHibernate.Mapping.SimpleValue.GetHeuristicType() +544 > > NHibernate.Mapping.SimpleValue.get_Type() +163 > > NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping) +57 > > NHibernate.Mapping.Property.IsValid(IMapping mapping) +56 > > NHibernate.Mapping.PersistentClass.Validate(IMapping mapping) +139 > > NHibernate.Mapping.RootClass.Validate(IMapping mapping) +45 > > NHibernate.Cfg.Configuration.ValidateEntities() +240 > > NHibernate.Cfg.Configuration.Validate() +30 > > NHibernate.Cfg.Configuration.BuildSessionFactory() +64 > > > > > > -Michael > > > > -- > > You received this message because you are subscribed to the Google > Groups "nhusers" group. > > To post to this group, send email to [email protected]<javascript:> > . > > To unsubscribe from this group, send email to > [email protected] <javascript:>. > > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > > > > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/Gw6kMV2kCYMJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
