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

Passing different Entities as parameter to ViewModel constructor

1 Answer 52 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
jay
Top achievements
Rank 1
jay asked on 19 Jun 2011, 01:45 AM

I have a ViewModel for an edit screen in a SL4 RIA Service solution that looks like this:

public GenericEditViewModel (int intA, string strB, RIA_EntityA entityObj)
        {
               ......
        }

 

 

I am using this same viewmodel to edit several entities, such that the type of entityObj is not constant.
How can I use the same ViewModel Constructor to handle calls for, say, RIA_EntityB, RIA_EntityC.......?
I tried generics, but that did not seem to work?

Thanks !

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 19 Jun 2011, 05:11 PM
Hello jay,

I suggest asking such general .NET questions on a place like StackOverflow.

Greetings,

Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
jay
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or