|
From: NHibernate J. <mik...@us...> - 2007-01-09 18:44:05
|
[ http://jira.nhibernate.org/browse/NH-648?page=3Dall ] Pierre Henri Kuat=C3=A9 updated NH-648: ---------------------------------- Description:=20 Hello KPixel, I have another improvement request for you. I defined a base class DomainOb= ject, which already defines an ID (note that PascalCaseMUnderScore is a cus= tom FieldAccessor so I can use strong typing instead of strings): =09public class DomainObjectInt : DomainObject<int> =09{ =09=09[Id(0, Name =3D "ID", Column =3D "ID", TypeType =3D typeof(Int32), Un= savedValue =3D "0", =09=09=09AccessType =3D typeof(PascalCaseMUnderScore))] =09=09[Generator(1, Class =3D "identity")] =09=09public override int ID =09=09{ =09=09=09get { return base.ID; } =09=09} =09} Now when I want to define inheritance hierarchies I run into trouble: =09[Class(0, NameType =3D typeof(Operation), Table =3D "[Operation]", Lazy = =3D false)] =09[Discriminator(1, Column =3D "Discriminator")] =09public abstract class Operation : DomainObjectInt, IOperation =09{ =09} I'd like to place the discriminator right at the top with the class definit= ion. However, it's only valid on property, indexer or field. The workaround= is to place it e.g. on top of the first member variable but that's mislead= ing when someone looks at the code. Is there a reason why I couldn't place that attribute on top of the class? Thanks, Christoph was: Hello Kpix, I have another improvement request for you. I defined a base class DomainOb= ject, which already defines an ID (note that PascalCaseMUnderScore is a cus= tom FieldAccessor so I can use strong typing instead of strings): =09public class DomainObjectInt : DomainObject<int> =09{ =09=09[Id(0, Name =3D "ID", Column =3D "ID", TypeType =3D typeof(Int32), Un= savedValue =3D "0", =09=09=09AccessType =3D typeof(PascalCaseMUnderScore))] =09=09[Generator(1, Class =3D "identity")] =09=09public override int ID =09=09{ =09=09=09get { return base.ID; } =09=09} =09} Now when I want to define inheritance hierarchies I run into trouble: =09[Class(0, NameType =3D typeof(Operation), Table =3D "[Operation]", Lazy = =3D false)] =09[Discriminator(1, Column =3D "Discriminator")] =09public abstract class Operation : DomainObjectInt, IOperation =09{ =09} I'd like to place the discriminator right at the top with the class definit= ion. However, it's only valid on property, indexer or field. The workaround= is to place it e.g. on top of the first member variable but that's mislead= ing when someone looks at the code. Is there a reason why I couldn't place that attribute on top of the class? Thanks, Christoph Summary: NHibernate.Mapping.Attributes - Allow [(Jcs)Cache], [Discr= iminator] and [Key] at class-level (was: Discriminator attribute allowed f= or class (not only property, field or indexer)) > NHibernate.Mapping.Attributes - Allow [(Jcs)Cache], [Discriminator] and [= Key] at class-level > -------------------------------------------------------------------------= ------------------- > > Key: NH-648 > URL: http://jira.nhibernate.org/browse/NH-648 > Project: NHibernate > Type: Improvement > Components: Contrib > Versions: 1.2.0.Alpha1 > Reporter: Christoph Wienands > Assignee: Pierre Henri Kuat=C3=A9 > Priority: Trivial > Fix For: 1.2.0.Beta3 > > Hello KPixel, > I have another improvement request for you. I defined a base class Domain= Object, which already defines an ID (note that PascalCaseMUnderScore is a c= ustom FieldAccessor so I can use strong typing instead of strings): > =09public class DomainObjectInt : DomainObject<int> > =09{ > =09=09[Id(0, Name =3D "ID", Column =3D "ID", TypeType =3D typeof(Int32), = UnsavedValue =3D "0", > =09=09=09AccessType =3D typeof(PascalCaseMUnderScore))] > =09=09[Generator(1, Class =3D "identity")] > =09=09public override int ID > =09=09{ > =09=09=09get { return base.ID; } > =09=09} > =09} > Now when I want to define inheritance hierarchies I run into trouble: > =09[Class(0, NameType =3D typeof(Operation), Table =3D "[Operation]", Laz= y =3D false)] > =09[Discriminator(1, Column =3D "Discriminator")] > =09public abstract class Operation : DomainObjectInt, IOperation > =09{ > =09} > I'd like to place the discriminator right at the top with the class defin= ition. However, it's only valid on property, indexer or field. The workarou= nd is to place it e.g. on top of the first member variable but that's misle= ading when someone looks at the code. > Is there a reason why I couldn't place that attribute on top of the class= ? > Thanks, Christoph --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |