How to generalize the repository content

Ask general questions here.
User avatar
Posts: 71
Joined: Tue Jan 06, 2015 8:26 am

How to generalize the repository content

Post by subodh4u7 » Wed Oct 21, 2015 11:37 am


I have once scenario where I want to pass parameter as below
Call Method(repo.organizer);

Call Method1(repo.Start)

Method(RepoScanConsoleFolders.OrganizerViewFolder seg1)
// some peice of code

Method1(RepoScanConsoleFolders.StartFolder seg2)
// some peice of code

I want to generalize the called method so that i can pass any repository type data rather calling method(), method1() separately.

Can you please help me out.
Last edited by subodh4u7 on Wed Oct 28, 2015 6:41 am, edited 1 time in total.

Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Re: How to generalize the repository content

Post by tvu » Wed Oct 21, 2015 6:46 pm

I don't know the best approach to this, but what I have been doing is to pass in the RepoItemInfo and creating an adapter from it. From there, you will interact with the adapter.

Code: Select all

Method(Ranorex.Core.Repository.RepoItemInfo myRepoItemInfo)
    Ranorex.Adapter myAdapter;

    if (myRepoItemInfo.Exist())
        myAdapter = myRepoItemInfo.CreateAdapter<Ranorex.Adapter>();
        return someErrorState;

    // code to do something with myAdapter
Hope this helps.