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

Using Interfaces

2 Answers 157 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rohan
Top achievements
Rank 1
Rohan asked on 29 Apr 2009, 01:58 AM
Hi there,

I am trying to implement my persitent classes using interfaces. I have created the following

public interface IFoo
{
    int Id {get;set;}
}

public class Foo : IFoo
{
    private int _id;

    public int Id {get{return _id;} set{_id = value;}}
}

public interface IBar
{
    int Id {get;set;}
    IFoo Foo {get;set;}
}

public class Bar : IBar
{
    private int _id;
    private IFoo _foo;

    public int Id {get{return _id;} set{_id = value;}}
    public IFoo Foo {get{return _foo;} set{_foo = value;}}
}

Is it possible to indicate that Foo is a valid class and to use it by default, i dont want to use the database to store the class type.

Thanks

Rohan

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander
Telerik team
answered on 29 Apr 2009, 10:02 AM
Hi Rohan,

If I understood you correctly you do not want to have the Foo discriminator column in the Bar table. I am afraid this is not possible because the reference in the Bar class has type IFoo. If you really do not want this column, then you will have to use directly a reference of type Foo.

Kind regards,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rohan
Top achievements
Rank 1
answered on 29 Apr 2009, 09:07 PM
Thanks for you response Alexander.
Tags
General Discussions
Asked by
Rohan
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Rohan
Top achievements
Rank 1
Share this question
or