Menu

Interface generated by DomainObjec problem

2006-09-21
2013-04-22
  • Wang Chuanbo

    Wang Chuanbo - 2006-09-21

    I found that there are some changes in the Repository.xsd file.
    Now if I want to create interface, I add "GenerateInterface='true'" attribute in ClassDescriptor, then generate the interface and class by DomainObjectGen. In some cases, the interfaces and classes are compiled in different DLL. The problem is that if there is ReferenceDescriptor, the interfaces generated by DomainObjectGen use class, not interface.
    For example:
    public partial interface IUserrole {
           
            [DomainObjects.Facade.Domain.MutatorAttribute()]
            int Roleinnerid {
                get;
                set;
            }
           
            [DomainObjects.Facade.Domain.MutatorAttribute()]
            int Userinnerid {
                get;
                set;
            }
           
            [DomainObjects.Facade.Domain.MutatorAttribute()]
            Boyuan.Security.Po.Role Role {
                get;
                set;
            }
           
            [DomainObjects.Facade.Domain.MutatorAttribute()]
            Boyuan.Security.Po.User User {
                get;
                set;
            }
           
            It is 'Boyuan.Security.Po.User', not 'Boyuan.Security.Po.IUser'.
         The same problem with 'CollectionDescriptor'.
           
    Now I modify the interface by hand.

    In the ojb-net, there is no such problem.

    Is there any other good solution in current release?

     
    • Richard Beauchamp

      Hi Wang,

      At this point there is no solution to your issue. We moved away from always generating interfaces along with the associated hard-coded 'hack' of sticking an 'I' in front of the class name when generating the interface references/collections.

      The interfaces don't add much value and I have learned that they just obscure the domain model by adding an extra layer between the outside world and the domain.

      In practice, your application can't effectively hide the concrete implementation behind an interface because the concrete types and their relationship/constraints must be known to create queries.

      Anyway, I hope this gives you some understanding and background on the change.

      Best regards,

      Richard

       

Log in to post a comment.