Hey guys, I'm experiencing the same issue. I'm running NH 2.1.0.4000GA
and Fluent NH 1.0.0.0.
I've tried using ExposeConfiguration the same way the Chris has with
no luck. I've also tried below, with the same outcome:
var nhConfig = Fluently.Configure()
...
.BuildConfiguration();
nhConfig.Properties
[Environment.CollectionTypeFactoryClass] =
typeof(CollectionTypeFactory).AssemblyQualifiedName;
nhConfig.Properties has an entry for collectiontype.factory_class, but
as Chris says, it just seems to be ignored when calling
nhConfig.BuildSessionFactory(). If I use XML mappings rather than
Fluent NH it all works fine.
CollectionTypeFactory is from
http://fabiomaulo.blogspot.com/2009/09/nhibernate-in-winform-coupled.html
Any help would be greatly appreciated!
Michael.
On Aug 26, 5:39 am, Chris Willard <[email protected]>
wrote:
> I just updated toFluent1.0 RC hoping that it would address this
> issue but it did not seem to help. Here is how I am handling the
> configuration. Do you see anything I might be doing wrong?
>
> private ISessionFactory BuildSessionFactory()
> {
> ISessionFactory result =
> Fluently.Configure()
> .Database(MsSqlConfiguration.MsSql2005
> .ConnectionString(c => c
> .FromConnectionStringWithKey
> (ConnectionStringName))
> .ShowSql())
> .ExposeConfiguration(ConfigureLazyLoad)
> .ExposeConfiguration(ConfigureCollectionType)
> .Mappings(m => m
> .FluentMappings.AddFromAssembly
> (_MapAssembly)
> .Conventions.AddFromAssemblyOf<ClassConvention>
> ())
> .ExposeConfiguration(ConfigureValidator)
> .BuildSessionFactory();
>
> return result;
> }
>
> private void ConfigureCollectionType(Configuration
> configuration)
> {
> configuration.SetProperty
> (Cfg.Environment.CollectionTypeFactoryClass, typeof
> (WpfCollectionTypeFactory).AssemblyQualifiedName);
> }
>
> Thanks,
> Chris
>
> On Aug 25, 12:41 pm, Fabio Maulo <[email protected]> wrote:
>
>
>
> > It should work.Code tested in NH and applyed in uNhAddIns.
>
> > 2009/8/25 Chris Willard <[email protected]>
>
> > > NH 2.1.0.4000 (GA)
>
> > > On Aug 25, 12:14 pm, Fabio Maulo <[email protected]> wrote:
> > > > NH version ?
>
> > > > 2009/8/25 Chris Willard <[email protected]>
>
> > > > > I just tried 731 and that did the trick. I no longer get an error when
> > > > > removing an item. Thanks! Now if I could just figure out how to get
> > > > > the CollectionTypeFactoryClass configuration to work withinfluent. I
> > > > > am using the ExposeConfiguration method which exposes
> > > > > NHibernate.Cfg.Configuration. I see that the property is added to the
> > > > > Properties collection after my call but it seems to just ignore it...
>
> > > > > Thanks again,
> > > > > Chris
>
> > > > > On Aug 25, 10:57 am, José Romaniello <[email protected]> wrote:
> > > > > > It is done in the R731.
> > > > >http://code.google.com/p/unhaddins/source/detail?r=731
> > > > > > <http://code.google.com/p/unhaddins/source/detail?r=731>
> > > > > > 2009/8/25 José Romaniello <[email protected]>
>
> > > > > > > I will make the change to return and index in the removed event of
> > > > > > > the observableset .
> > > > > > > For the other hand, somewherefluentnh has to give you some access
> > > to
> > > > > the
> > > > > > > nhibernate configuration.
>
> > > > > > > 2009/8/25 Chris Willard <[email protected]>
>
> > > > > > >> Yeah, it is pretty strange. It seems to work fine with the Happy
> > > > > > >> Nomad implementation of ObservableSet I mentioned at the
> > > > > > >> beginning
> > > of
> > > > > > >> my post so I guess I can just stick with that for now. I just
> > > wish I
> > > > > > >> could figure out a way to configure itgloballyviaFluent. Thank
> > > you
> > > > > > >> both for all your help and advice.
>
> > > > > > >> Chris
>
> > > > > > >> On Aug 25, 6:35 am, José Romaniello <[email protected]>
> > > wrote:
> > > > > > >> > Chris , this could be a problem of the calling code (maybe
> > > > > > >> > wpf),
> > > > > since
> > > > > > >> > withing aSetwe haven'ta index for items.. And the event
> > > handler
> > > > > of
> > > > > > >> > "CollectionChanged" want the index of the item that was remove.
> > > You
> > > > > > >> could
> > > > > > >> > see the test here:http://digg.com/u1BO0j(
> > > > > > >> > removeall_should_raise_collectionchanged_for_removeditems).
>
> > > > > > >> > I don'tknow how tosetwithfluentnhibernate the collection
> > > type
> > > > > > >> factory.
>
> > > > > > >> > For the other hand, 100% AGREE with Fabio.
> > > > > > >> > For instance the class that Fabio show to you, in "runtime",
> > > > > implements
> > > > > > >> > INotifyPropertyChanged and IDataErrorInfo.
> > > > > > >> > There is also another behavior for IEditableObject, actually
> > > there
> > > > > are
> > > > > > >> > two. You could see how I configure the entityhttp://
> > > digg.com/u1BO11
>
> > > > > > >> > 2009/8/25 Fabio Maulo <[email protected]>
>
> > > > > > >> > > what I mean is that you can do the same without that boiled
> > > code.
>
> > > > > > >> > > 2009/8/25 Chris Willard <[email protected]>
>
> > > > > > >> > >> Those interfaces are implemented in my entity base class
> > > > > > >> > >> (BindableObject) from which GuidPOCO is derived (Section >
> > > > > GuidPOCO >
> > > > > > >> > >> BindableObject). I am not familiar with the term boiled
> > > code, so
> > > > > I
> > > > > > >> am
> > > > > > >> > >> not sure how to respond. Please let me know if you need any
> > > > > > >> > >> additional info or if I am misunderstanding something.
>
> > > > > > >> > >> This is how my base class is defined:
>
> > > > > > >> > >> public abstract class BindableObject :
> > > INotifyPropertyChanged,
> > > > > > >> > >> IEditableObject, IDataErrorInfo
>
> > > > > > >> > >> Thanks in advance,
> > > > > > >> > >> Chris
>
> > > > > > >> > >> On Aug 24, 10:53 pm, Fabio Maulo <[email protected]>
> > > wrote:
> > > > > > >> > >> > Classes in this domainhttp://
>
> > > code.google.com/p/unhaddins/source/browse/trunk/Examples/uNHAd.
> > > > > ..
> > > > > > >> > >> > <
>
> > > > >http://code.google.com/p/unhaddins/source/browse/trunk/Examples/uNHAd
> > > > > > >> ..
> > > > > > >> > >> .>are
> > > > > > >> > >> > implementing INotifyPropertyChanged, IEditableObject,
> > > > > > >> IDataErrorInfo...
> > > > > > >> > >> > but... where is the boiled code ?
>
> > > > > > >> > >> > how that entities can work in this video ? (see bottom)
>
> > >http://jfromaniello.blogspot.com/2009/08/nhibernate-and-wpf-viewmodel.
> > > > > ..
>
> > > > > > >> > >> > 2009/8/25 Chris Willard <[email protected]>
>
> > > > > > >> > >> > > Yeah, I was thinking he wanted to see the entire entity
> > > for
> > > > > some
> > > > > > >> > >> > > reason...
>
> > > > > > >> > >> > > On Aug 24, 10:06 pm, Fabio Maulo <[email protected]>
> > > > > wrote:
> > > > > > >> > >> > > > too much boiled code.
>
> > > > > > >> > >> > > > 2009/8/24 Chris Willard <
> > > [email protected]>
>
> > > > > > >> > >> > > > > Oh yeah, sorry. I am calling this extension method
> > > to
> > > > > remove
> > > > > > >> the
> > > > > > >> > >> > > > > item:
>
> > > > > > >> > >> > > > > public static void RemoveRange<T>(this
> > > > > ICollection<T>
> > > > > > >> > >> > > > > collection, IEnumerable<T> items)
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > if (items != null)
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > foreach (var item in items)
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > collection.Remove(item);
> > > > > > >> > >> > > > > }
> > > > > > >> > >> > > > > }
> > > > > > >> > >> > > > > }
>
> > > > > > >> > >> > > > > And this is the entity:
>
> > > > > > >> > >> > > > > using System;
> > > > > > >> > >> > > > > using System.Collections.Generic;
> > > > > > >> > >> > > > > using System.Linq;
> > > > > > >> > >> > > > > using System.Text;
> > > > > > >> > >> > > > > using RGI.Utilities;
> > > > > > >> > >> > > > > using RGI.Utilities.Validators;
> > > > > > >> > >> > > > > using uNhAddIns.WPF.Collections;
>
> > > > > > >> > >> > > > > namespace RGI.BMS.POCO
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > [Serializable]
> > > > > > >> > >> > > > > public class Section : GuidPOCO
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > #region Constructors
>
> > > > > > >> > >> > > > > public Section() : base()
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > this.SectionNumbers = new
> > > > > > >> > >> ObservableSet<SectionNumber>();
> > > > > > >> > >> > > > > }
>
> > > > > > >> > >> > > > > #endregion
>
> > > > > > >> > >> > > > > #region Fields
>
> > > > > > >> > >> > > > > private string _Name;
> > > > > > >> > >> > > > > private Employee _ModifiedBy;
> > > > > > >> > >> > > > > private DateTime _ModifiedDate;
> > > > > > >> > >> > > > > private ICollection<SectionNumber>
> > > > > _SectionNumbers;
>
> > > > > > >> > >> > > > > #endregion
>
> > > > > > >> > >> > > > > #region Properties
>
> > > > > > >> > >> > > > > public virtual string Name
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > get { return _Name; }
> > > > > > >> > >> > > > > set
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > _Name = value;
> > > > > > >> > >> > > > > NotifyPropertyChanged("Name");
> > > > > > >> > >> > > > > }
> > > > > > >> > >> > > > > }
>
> > > > > > >> > >> > > > > public virtual Employee ModifiedBy
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > get { return _ModifiedBy; }
> > > > > > >> > >> > > > > set
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > _ModifiedBy = value;
> > > > > > >> > >> > > > > NotifyPropertyChanged("ModifiedBy");
> > > > > > >> > >> > > > > }
> > > > > > >> > >> > > > > }
>
> > > > > > >> > >> > > > > public virtual DateTime ModifiedDate
> > > > > > >> > >> > > > > {
> > > > > > >> > >> > > > > get { return _ModifiedDate; }...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---