This is a migrated thread and some comments may be shown as answers.

Persistent interface

3 Answers 30 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Markus
Top achievements
Rank 1
Markus asked on 17 Apr 2012, 03:06 PM
Hello,

how do I make an interface persistent with FluentMapping? In old API it was possible an required columns where automatically created ( object_id and object_class).

An example:
public interface IOwner
    {
        int Id { get; set; }
        string Name { get; set; }
    }
 
public class Company : IOwner
    {
        public int Id { get; set; }
 
        public string Name { get; set; }
}
 
 public class User : IOwner
    {
        public int Id { get; set; }
 
        public string Name { get; set; }
}
 
 public class Resource
    {
 
        public int Id { get; set; }
 
        public string Key{ get; set; }
       
        public IOwner Owner { get; set; }   //can be User or Company
}

3 Answers, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 20 Apr 2012, 02:41 PM
Hi Markus,

 Currently there is no explicit handling for the interfaces themselves. If your classes are inheriting an interface and there are some properties coming from that interface you will have to manually map them in each of the classes that derive from the interface.

Greetings,
Petar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the OpenAccess ORM, subscribe to their blog feed now.
0
Markus
Top achievements
Rank 1
answered on 23 Apr 2012, 09:48 AM
Hello Petar,

thanks for your answer. But I think you misunderstood my question. It was not concerning the implementing classes. It was about the referencing class 'Resource'. In old API OpenAccess generated two columns ( object_id and object_class_id ) for the referencing field 'Owner', because it is an interface and target object could be of many class types. OpenAccess has automatically resolved the object reference when accessing the property. It was also possible to define valid classes. Descriped in Programmer's Reference in Section 'Mapping an Interface or Object Reference' (old API).

Regards,
Markus
0
PetarP
Telerik team
answered on 26 Apr 2012, 04:09 PM
Hello Markus,

 Unfortunately as I said in my previous post we are not providing any additional handling for interfaces. If you would like to achieve the same result you will have to provide those columns manually.

Kind regards,
Petar
the Telerik team
Follow @OpenAccessORM Twitter channel to get first the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Tags
Development (API, general questions)
Asked by
Markus
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Markus
Top achievements
Rank 1
Share this question
or