public enum ActivityType
{
Form = 1,
Custom = 2,
Email = 3
}
I tried to change:
mapper.Subclass<FormActivity>(map=>map.DiscriminatorValue( 1 )); , but
with the same error
On May 4, 1:23 pm, Fabio Maulo <[email protected]> wrote:
> what is ActivityType ?
>
>
>
>
>
>
>
>
>
> On Wed, May 4, 2011 at 8:17 AM, Luka <[email protected]> wrote:
> > hi, Fabio
>
> > I have corrected my scenario like this:
> > mapper.Class<Activity>(map =>
> > {
> > map.Discriminator(dm =>
> > {
>
> > dm.Column("DISCRIMINATOR_TYPE");
>
> > dm.Type(typeof(System.Int32));
> > dm.NotNullable(true);
> > });
> > });
> > mapper.Subclass<FormActivity>(map=>map.DiscriminatorValue(ActivityType.Form
> > ));
>
> > Now discriminator is not a Property anymore. But I get same error.
>
> > On May 4, 12:59 pm, Fabio Maulo <[email protected]> wrote:
> > > The discriminator *can't* be a property.
>
> > > On Wed, May 4, 2011 at 6:18 AM, Luka <[email protected]> wrote:
> > > > Hi,
> > > > I have this scenarion:
>
> > > > A table:
>
> > > > Activity
> > > > .Id : Guid
> > > > .Type: int
> > > > .Title: nvarchar(20)
> > > > ...
>
> > > > Classes
> > > > public class Activity: Entity
> > > > {
> > > > public virtual ActivityType Type {get;set;}
> > > > public virtual string Title {get;set;}
> > > > }
>
> > > > public class FormActivity: Activity
> > > > {
>
> > > > }
>
> > > > and a mapping:
> > > > mapper.Class<Activity>(map =>
> > > > {
>
> > > > map.Discriminator(dm=>dm.Column("TYPE"));
> > > > });
>
> > mapper.Subclass<FormActivity>(map=>map.DiscriminatorValue(ActivityType.Form
> > ));
>
> > > > When building SessionFactory I get Exception
>
> > > > System.InvalidOperationException: Sequence contains more than one
> > > > matching element
> > > > It throws when get on this line:
>
> > mapper.Subclass<FormActivity>(map=>map.DiscriminatorValue(ActivityType.Form
> > ));
>
> > > > what am I doing wrong?
>
> > > > --
> > > > 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.
>
> > > --
> > > Fabio Maulo
>
> > --
> > 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.
>
> --
> Fabio Maulo
--
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.