Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Exception on Mapper.Class<T>(Property)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  16 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matteo Migliore  
View profile  
 More options May 25 2011, 1:59 pm
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Wed, 25 May 2011 10:59:34 -0700 (PDT)
Local: Wed, May 25 2011 1:59 pm
Subject: Exception on Mapper.Class<T>(Property)
Hi!

I'm wrapping ConfOrm to have the simplest code as possible to map an
entity.

I've this code on a "mapping class":
public class CustomerMapper : UniqueEntityMapping<Customer>
{
    public CustomerMapper()
    {
        Property(p => p.FirstName, pm => { pm.Length(200);
pm.NotNullable(true); });
        Property(p => p.LastName, pm => { pm.Length(250);
pm.NotNullable(true); });
    }

}

I call this method in the base class of the "mapping class":
mapper.Class<TEntity>(c => c.Property(p => property.Key,
property.Value));

Where localProperty is a:
KeyValuePair<object, Action<IPropertyMapper>>.

I obtain this exception:
{"Value cannot be null.\r\nParameter name: localMember"}

StackTrace:
   at ConfOrm.NH.PropertyPath..ctor(PropertyPath previousPath,
MemberInfo localMember)
   at
ConfOrm.NH.CustomizersImpl.PropertyContainerCustomizer`1.Property[TProperty ]
(Expression`1 property, Action`1 mapping)
   at
EyeOpen.Data.Nhibernate.ConformModelMapping.<>c__DisplayClass6`1.<Register> b__3(IClassMapper`1
c) in E:\Dropbox\Eye.World\Business\Eye.Soft.v2\Dev\Hyperion\Main\Op
\Core\Proj\Sdk\DataAccessSdk\Src\Data.IntegrationTest\Nhibernate
\Mapping\Class\ConformModelMapping.cs:line 72
   at ConfOrm.NH.Mapper.Class[TRootEntity](Action`1 customizeAction)
   at EyeOpen.Data.Nhibernate.ConformModelMapping.Register[TEntity]
(IEntityMapping`1 entityConfiguration) in E:\Dropbox\Eye.World\Business
\Eye.Soft.v2\Dev\Hyperion\Main\Op\Core\Proj\Sdk\DataAccessSdk\Src
\Data.IntegrationTest\Nhibernate\Mapping\Class
\ConformModelMapping.cs:line 72
   at EyeOpen.Data.IntegrationTest.Nhibernate.FooModelMapping..ctor()
in E:\Dropbox\Eye.World\Business\Eye.Soft.v2\Dev\Hyperion\Main\Op\Core
\Proj\Sdk\DataAccessSdk\Src\Data.IntegrationTest\Nhibernate
\FooModelMapping.cs:line 9
   at
EyeOpen.Data.IntegrationTest.Nhibernate.NhibernateRepositoryTest.ClassIniti alize(TestContext
testContext) in E:\Dropbox\Eye.World\Business\Eye.Soft.v2\Dev\Hyperion
\Main\Op\Core\Proj\Sdk\DataAccessSdk\Src\Data.IntegrationTest
\NhibernateRepositoryTest.cs:line 27

Any idea?

I'm doing this in the HSDK project:
http://goo.gl/EuejX

This code is not yet published.

Thanks a lot.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabio Maulo  
View profile  
 More options May 25 2011, 6:21 pm
From: Fabio Maulo <fabioma...@gmail.com>
Date: Wed, 25 May 2011 19:21:27 -0300
Local: Wed, May 25 2011 6:21 pm
Subject: Re: [ConfORM] Exception on Mapper.Class<T>(Property)

The exception is clear.
What is not clear is UniqueEntityMapping<T>
btw you are wrongly creating an instance of PropertyPath passing a null as
localMember

On Wed, May 25, 2011 at 2:59 PM, Matteo Migliore
<matteo.migli...@gmail.com>wrote:

--
Fabio Maulo

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matteo Migliore  
View profile  
 More options May 25 2011, 6:26 pm
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Wed, 25 May 2011 15:26:41 -0700 (PDT)
Local: Wed, May 25 2011 6:26 pm
Subject: Re: Exception on Mapper.Class<T>(Property)
On May 26, 12:21 am, Fabio Maulo <fabioma...@gmail.com> wrote:

> The exception is clear.

Yes, it is :).

But I don't understand how to solve it.

> What is not clear is UniqueEntityMapping<T>
> btw you are wrongly creating an instance of PropertyPath passing a null as
> localMember

I can publish the latest version of source code.

Btw the base class of UniqueEntityMapping<T> is:
public abstract class EntityMapping<TEntity> :
        IEntityMapping<TEntity>
        where TEntity : IUniqueEntity
{
        private readonly IDictionary<object, Action<IPropertyMapper>>
properties =
                new Dictionary<object, Action<IPropertyMapper>>();

        private readonly IDictionary<object, FluentPropertyMapper>
properties2 =
                new Dictionary<object, FluentPropertyMapper>();

        public IEnumerable<KeyValuePair<object, Action<IPropertyMapper>>>
Properties
        {
                get { return properties; }
        }

        public IEnumerable<KeyValuePair<object, FluentPropertyMapper>>
Properties2
        {
                get { return properties2; }
        }

        public Action<IIdMapper> IdMapper
        {
                get; private set;
        }

        public virtual MappingStrategies Strategy
        {
                get { return MappingStrategies.TablePerClass; }
        }

        public void Id(Action<IIdMapper> idMapper)
        {
                IdMapper = idMapper;
        }

        public FluentPropertyMapper
FluentProperty<TProperty>(Expression<Func<TEntity, TProperty>>
property)
        {
                var propertyMember =
                        typeof(TEntity)
                                .GetProperty(ExpressionHelper<TEntity>.GetPropertyName(property),
BindingFlags.Instance | BindingFlags.Public);

                var fluentPropertyMapper = new FluentPropertyMapper(propertyMember,
new NHibernate.Cfg.MappingSchema.HbmProperty());

                properties2.Add(property, fluentPropertyMapper);

                return fluentPropertyMapper;
        }

        public void Property<TProperty>(Expression<Func<TEntity, TProperty>>
property, Action<IPropertyMapper> action)
        {
                properties.Add(property, action);
        }

}

Thx again!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matteo Migliore  
View profile  
 More options May 25 2011, 6:34 pm
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Wed, 25 May 2011 15:34:22 -0700 (PDT)
Local: Wed, May 25 2011 6:34 pm
Subject: Re: Exception on Mapper.Class<T>(Property)
The problem could be in the first line of method Property of the class
PropertyContainerCustomizer<TEntity>:
MemberInfo localMember =
TypeExtensions.DecodeMemberAccessExpression<TEntity,
TProperty>(property);

But I checked, TypeExtensions works well.

Uhm...

On May 26, 12:26 am, Matteo Migliore <matteo.migli...@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matteo Migliore  
View profile  
 More options May 26 2011, 7:04 am
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Thu, 26 May 2011 04:04:45 -0700 (PDT)
Local: Thurs, May 26 2011 7:04 am
Subject: Re: Exception on Mapper.Class<T>(Property)
I published the latest version here: http://goo.gl/DlErQ.

To test the code you have to go to EyeOpen.Data.IntegrationTest
project,
remove the comment ////INhibernateMapping mapping = new
FooModelMapping();
to use the FooModelMapping class and run the tests.

Thx!

On May 26, 12:34 am, Matteo Migliore <matteo.migli...@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matteo Migliore  
View profile  
 More options May 26 2011, 10:38 am
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Thu, 26 May 2011 07:38:52 -0700 (PDT)
Local: Thurs, May 26 2011 10:38 am
Subject: Re: Exception on Mapper.Class<T>(Property)
With a pair with Alessandro (Giorgetti) in Skype/TeamViewer all works
now.

On CodePlex you can find the latest version:
http://goo.gl/SXxNK

Now is possible to write this using ConfOrm:
var connection =
        new NhibernateMicrosoftSqlServerConnection
                {
                        DataSource = Connection.DataSource,
                        Catalog = string.Concat(Connection.Catalog),
                        IsTrustedConnection = Connection.IsTrustedConnection
                };

INhibernateMapping mapping = new FooModelMapping();
////INhibernateMapping mapping = new FooFlatModelMapping();

configuration =
        new NhibernateConfigurationBuilder()
                .ProxyFactory<NHibernate.ByteCode.Castle.ProxyFactoryFactory>()
                .Build(connection, mapping.GetMapping());

sessionFactory = configuration.BuildSessionFactory();

And the mapping:
public class CustomerMapper : UniqueEntityMapping<Customer>
{
        public CustomerMapper()
        {
                Property(p => p.FirstName)
                        .Lenght(200)
                        .NotNullable(true);

                Property(p => p.LastName)
                        .Lenght(200)
                        .NotNullable(true);
        }

}

Great!
On May 26, 1:04 pm, Matteo Migliore <matteo.migli...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabio Maulo  
View profile  
 More options May 26 2011, 1:03 pm
From: Fabio Maulo <fabioma...@gmail.com>
Date: Thu, 26 May 2011 14:03:37 -0300
Local: Thurs, May 26 2011 1:03 pm
Subject: Re: [ConfORM] Re: Exception on Mapper.Class<T>(Property)

It seems this:
http://fabiomaulo.blogspot.com/2011/04/me-on-fluent-nhibernate.html

On Thu, May 26, 2011 at 11:38 AM, Matteo Migliore <matteo.migli...@gmail.com

--
Fabio Maulo

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matteo Migliore  
View profile  
 More options May 26 2011, 1:52 pm
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Thu, 26 May 2011 10:52:54 -0700 (PDT)
Local: Thurs, May 26 2011 1:52 pm
Subject: Re: Exception on Mapper.Class<T>(Property)
Oh god :(. U're right. I also read your post time ago... Grrr :).

Anyway, the scope of the mapping is have an abstract mapping system to
use with EF and NH.

On May 26, 7:03 pm, Fabio Maulo <fabioma...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabio Maulo  
View profile  
 More options May 26 2011, 2:52 pm
From: Fabio Maulo <fabioma...@gmail.com>
Date: Thu, 26 May 2011 15:52:38 -0300
Local: Thurs, May 26 2011 2:52 pm
Subject: Re: [ConfORM] Re: Exception on Mapper.Class<T>(Property)

That is what ConfORM mean.

On Thu, May 26, 2011 at 2:52 PM, Matteo Migliore
<matteo.migli...@gmail.com>wrote:

--
Fabio Maulo

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matteo Migliore  
View profile  
 More options May 26 2011, 3:02 pm
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Thu, 26 May 2011 12:02:46 -0700 (PDT)
Local: Thurs, May 26 2011 3:02 pm
Subject: Re: Exception on Mapper.Class<T>(Property)
I don't understand.

I'm creating a mapping system that could be used with EF and NH.

Do you plan to make ConfOrm separated to NH for a part to allow to use
it with EF also?

On May 26, 8:52 pm, Fabio Maulo <fabioma...@gmail.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabio Maulo  
View profile  
 More options May 26 2011, 4:25 pm
From: Fabio Maulo <fabioma...@gmail.com>
Date: Thu, 26 May 2011 17:25:08 -0300
Local: Thurs, May 26 2011 4:25 pm
Subject: Re: [ConfORM] Re: Exception on Mapper.Class<T>(Property)

Since the beginning... that is the reason of the generic name not referring
NH.
btw, EF4 has too few features to be used in a pure OO domain-model.

On Thu, May 26, 2011 at 4:02 PM, Matteo Migliore
<matteo.migli...@gmail.com>wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matteo Migliore  
View profile  
 More options May 26 2011, 4:36 pm
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Thu, 26 May 2011 13:36:12 -0700 (PDT)
Local: Thurs, May 26 2011 4:36 pm
Subject: Re: Exception on Mapper.Class<T>(Property)
Oh wonderful! So cannot separate it from NH "ASAP"? I can use ConfOrm
with EF "now"
because for some project I don't need all feats of NH and of course I
would publish source
code of our progress (the team of HSDK where there's Alessandro
Giorgetti also).

On May 26, 10:25 pm, Fabio Maulo <fabioma...@gmail.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
José F. Romaniello  
View profile  
 More options May 26 2011, 4:47 pm
From: José F. Romaniello <jfromanie...@gmail.com>
Date: Thu, 26 May 2011 17:47:17 -0300
Local: Thurs, May 26 2011 4:47 pm
Subject: Re: [ConfORM] Re: Exception on Mapper.Class<T>(Property)

In the current state of the art, i don't recommend you to build nothing on
top of EF.
OTOH; I don't see why something like that will be useful. Each ORM has their
own features for mapping... or at least EF has much less than NH, why you
would abstract the mapping thing?
With the current ORMs in .Net you can't map a four-class domain as-is in two
different ORMs.
This menas that if you want to change the orm you have to do major changes
in your entities...

2011/5/26 Matteo Migliore <matteo.migli...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabio Maulo  
View profile  
 More options May 26 2011, 4:47 pm
From: Fabio Maulo <fabioma...@gmail.com>
Date: Thu, 26 May 2011 17:47:39 -0300
Local: Thurs, May 26 2011 4:47 pm
Subject: Re: [ConfORM] Re: Exception on Mapper.Class<T>(Property)

Salutalo e digli che un solo sistema di query, che non da alcuna chance di
essere ottimizzato, non é first class citizen

On Thu, May 26, 2011 at 5:36 PM, Matteo Migliore
<matteo.migli...@gmail.com>wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matteo Migliore  
View profile  
 More options May 26 2011, 6:13 pm
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Thu, 26 May 2011 15:13:17 -0700 (PDT)
Local: Thurs, May 26 2011 6:13 pm
Subject: Re: Exception on Mapper.Class<T>(Property)
I know quite well EF to do this :). It can be used in simple
scenarios.

I want to abstract the mapping to switch from EF to NH with less
impact, not no impact.

Look at the project on CodePlex :)

On May 26, 10:47 pm, José F. Romaniello <jfromanie...@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matteo Migliore  
View profile  
 More options May 26 2011, 6:15 pm
From: Matteo Migliore <matteo.migli...@gmail.com>
Date: Thu, 26 May 2011 15:15:15 -0700 (PDT)
Local: Thurs, May 26 2011 6:15 pm
Subject: Re: Exception on Mapper.Class<T>(Property)
Come dicevo, in scenari molto semplici anche EF IMHO può essere
adottato.

Certo, non è ancora neanche paragonabile a NH, ma ci sono alcune
similutidini che non mi sarei
aspettato prima di iniziarlo a studiare più approfonditamente :).

On May 26, 10:47 pm, Fabio Maulo <fabioma...@gmail.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »