I'm not sure why it wasnt working without the strict assembly name,  
but I finally found the source of the "Ambiguous" exception.

(cross-posted from nhusers.)

It was related to this:

//m.Map(
//    Reveal.Property<ProvidedInsuranceCardData>(
//        "providedMemberIdOfPatient"),
//      "vc_MemberID");

m.Map(x => x.ProvidedMemberIdOfPatient,  
"vc_MemberID").Access.AsCamelCaseField();

I had to replace the commented stuff with the uncommented stuff. I  
also had to change "providedMemberIdOfPatient" from a protected  
internal auto-property to a proper private field. (The crazy thing is  
that I can't remember why I did it so bass-ackwards to begin with...)

Thanks for your help.

On Jul 26, 2009, at 7:13 AM, Dmitiry Nagirnyak wrote:

> Try to check the exact assembly version.
>
> 2009/7/26 brendanjerwin <[email protected]>
>
> Yep. All referenced and marked to copy.
>
> On Jul 25, 5:16 pm, Ben Hyrman <[email protected]> wrote:
> > Are the following assemblies in your bin directory?
> >
> > NHibernate.ByteCode.Castle.dll
> > Castle.DynamicProxy2.dll
> > Castle.Core.dll
> >
> > Ben
> >
> >
> >
> > On Sat, Jul 25, 2009 at 12:00 PM, Brendan  
> Erwin<[email protected]> wrote:
> >
> > > I'm at a loss here. I'm trying to upgrade my project to the latest
> > > fluent + NH 2.1.
> >
> > > When I do my configuration like this:
> >
> > > var factory = Fluently.Configure(cfg)
> > >                 .Database(databaseConfigurer)
> > >                 .Mappings(m
> > > =>m.FluentMappings.AddFromAssemblyOf<PatientMap>()
> > >                              .ConventionDiscovery
> > > .AddFromAssemblyOf<PatientMap>())
> > >                 .ExposeConfiguration(c =>
> > >                                          {
> > >                                              ve =
> > > ConfigureValidator(c);
> >
> > > c.SetProperty("adonet.batch_size", "5");
> >
> > > c.SetProperty("generate_statistics", "true");
> > >                                          })
> > >                 .BuildSessionFactory();
> >
> > > fluent-nhibernate defaults to the Castle ProxyFactoryFactory but  
> I get
> > > a:
> >
> > > System.IO.FileNotFoundException: Could not load file or assembly
> > > 'NHibernate.ByteCode.Castle' or one of its dependencies. The  
> system
> > > cannot find the file specified.
> > > at System.Reflection.Assembly._nLoad(AssemblyName fileName, String
> > > codeBase, Evidence assemblySecurity, Assembly locationHint, ref
> > > StackCrawlMark stackMark, Boolean throwOnFileNotFound, Boolean
> > > forIntrospection)
> > > at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
> > > codeBase, Evidence assemblySecurity, Assembly locationHint, ref
> > > StackCrawlMark stackMark, Boolean throwOnFileNotFound, Boolean
> > > forIntrospection)
> > > at System.Reflection.Assembly.InternalLoad(AssemblyName  
> assemblyRef,
> > > Evidence assemblySecurity, ref StackCrawlMark stackMark, Boolean
> > > forIntrospection)
> > > at System.Reflection.Assembly.InternalLoad(String assemblyString,
> > > Evidence assemblySecurity, ref StackCrawlMark stackMark, Boolean
> > > forIntrospection)
> > > at System.Reflection.Assembly.Load(String assemblyString)
> > > at
> > > NHibernate
> > > .Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName  
> name,
> > > Boolean throwOnError)
> > > at NHibernate.Util.ReflectHelper.ClassForName(String name)
> > > at
> > > NHibernate
> > > .Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory(String
> > > typeName)
> >
> > > I've made sure to reference and mark to copy the
> > > NHibernate.ByteCode.Castle assembly and it's dependancies.
> >
> > > As a matter of fact, when I do my configuration like this:
> >
> > > var factory = Fluently.Configure(cfg)
> > >                 .Database(databaseConfigurer)
> > >                 .Mappings(m
> > > =>m.FluentMappings.AddFromAssemblyOf<PatientMap>()
> > >                              .ConventionDiscovery
> > > .AddFromAssemblyOf<PatientMap>())
> > >                 .ExposeConfiguration(c =>
> > >                                          {
> > >                                              ve =
> > > ConfigureValidator(c);
> >
> > > c.SetProperty("adonet.batch_size", "5");
> >
> > > c.SetProperty("generate_statistics", "true");
> >
> > > c.SetProperty("proxyfactory.factory_class",
> > >                                                  typeof
> > >  
> (NHibernate 
> .ByteCode.Castle.ProxyFactoryFactory).AssemblyQualifiedName);
> > >                                          })
> > >                 .BuildSessionFactory();
> >
> > > [Note the addition of:
> >
> > > c.SetProperty("proxyfactory.factory_class",
> > >                                                  typeof
> > >  
> (NHibernate 
> .ByteCode.Castle.ProxyFactoryFactory).AssemblyQualifiedName);
> >
> > > ]
> >
> > > It compiles, but I get a new and exciting exception while  
> configuring:
> >
> > > System.Reflection.AmbiguousMatchException: Ambiguous match found.
> > > at System.RuntimeType.GetPropertyImpl(String name, BindingFlags
> > > bindingAttr, Binder binder, Type returnType, Type[] types,
> > > ParameterModifier[] modifiers)
> > > at System.Type.GetProperty(String name, BindingFlags bindingAttr)
> > > at  
> NHibernate.Properties.BasicPropertyAccessor.GetSetterOrNull(Type
> > > type, String propertyName)
> > > at NHibernate.Properties.BasicPropertyAccessor.GetSetter(Type  
> type,
> > > String propertyName)
> > > at NHibernate.Mapping.Property.GetSetter(Type clazz)
> > > at
> > >  
> NHibernate.Tuple.Component.PocoComponentTuplizer.BuildSetter(Component
> > > component, Property prop)
> > > at
> > >  
> NHibernate.Tuple.Component.AbstractComponentTuplizer..ctor(Component
> > > component)
> > > at  
> NHibernate.Tuple.Component.PocoComponentTuplizer..ctor(Component
> > > component)
> > > at
> > > NHibernate
> >  
> > 
>  .Tuple.Component.ComponentEntityModeToTuplizerMapping..ctor(Component
> > > component)
> > > at NHibernate.Tuple.Component.ComponentMetamodel..ctor(Component
> > > component)
> > > at NHibernate.Mapping.Component.BuildType()
> > > at NHibernate.Mapping.Component.get_Type()
> > > at NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping)
> > > at NHibernate.Mapping.PersistentClass.Validate(IMapping mapping)
> > > at NHibernate.Mapping.RootClass.Validate(IMapping mapping)
> > > at NHibernate.Cfg.Configuration.Validate()
> > > at NHibernate.Cfg.Configuration.BuildSessionFactory()
> > > at  
> FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in
> > > FluentConfiguration.cs: line 93
> >
> > > Any ideas?
> >
> > > Also, why is the fluent access for setting the ProxyFactoryFactory
> > > hanging off the database configuration? I don't understand that.  
> It
> > > doesn't really work for me there since I configure my database for
> > > different cases. Sqlite for unit tests vs. MS sql server 2005 for
> > > production.
> >
> > > (FYI, the "ve = ConfigureValidator(c);" bit is the NHibernate
> > > Validator. I don't think it matters, but...)
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to