From: Michael T. (JIRA) <nh...@gm...> - 2011-05-25 18:16:06
|
[ http://216.121.112.228/browse/NH-2739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21195#action_21195 ] Michael Teper commented on NH-2739: ----------------------------------- I tried adding the following bit to specify the type: map.Property(x => x.Data, m => m.Type<BinaryBlobType>()); but got the following error: [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 > Can't get ByCode mapping to produce not nullable varbinary(max) > --------------------------------------------------------------- > > Key: NH-2739 > URL: http://216.121.112.228/browse/NH-2739 > Project: NHibernate > Issue Type: Bug > Components: Mapping by-code > Affects Versions: 3.2.0Beta1 > Reporter: Michael Teper > Priority: Major > > Trying to map the following class: > public class MyData > { > public byte[] Data { get; set; } > } > to 'varbinary(max) (not null)' field in SQL Server 2008. > mapper.Class<MyData>(map => > { > map.Property(x => x.Data, m => m.Length(int.MaxValue)); > map.Property(x => x.Data, m => m.NotNullable(true)); > }); > produces 'image(null)' -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |