0

I am building a .dll from a webservice to look like so:

namespace MyDllFromWebService
{
    public class AnimalDll_2013
    {    
        public AnimalApi.Animal UpdateAnimal(Animal animal)
        {
            return new AnimalApi().UpdateAnimal(credentials, animal)
        }

        public AnimalApi.Animal GetAnimal(int id)
        {
            return new AnimalApi().GetAnimal(credentials, id)
        }
    }

    //I WOULD LIKE FOR THIS TO BE USED
    public class Animal
    {

    }
}

I am running into issues with the Animal class. I want to be able to use an Animal class in my main namespace (not AnimalApi.Animal).

How do I go about making this happen? (I tried inheriting but i have xml errors "not excepted)

Please point me in the right direction as to how to use XmlInclude properly or something.

Ideally, i would like to leave Reference.cs as is but if i need to change it, i can (I would like to do it from my main class). Thanks.

user1867353
  • 487
  • 1
  • 6
  • 12
  • Why do you need to use a different namespace? Do you have a circular reference problem? If so, inheritance will not solve it. -- Ignore this comment. I didn't read your last graph. – Keith Payne Sep 03 '13 at 18:19
  • Because i want to hide the actual web reference from my Dll, i just want namespace MyDllFromWebService to be used. So what i am trying to ultimately accomplish is to use an "Animal" class in MyDllFromWebService that resembles "Animal" in AnimalApi – user1867353 Sep 03 '13 at 18:33
  • This does not make sense to me. You should not change `Reference.cs` at all. If you want to use the web-service in another class, create a variable set to a new instance of `AnimalDll_2013` and call the Update or Get method. If you want something in between the caller and `AnimalDll_2013`, create another class that implements the methods that you need and within that class call the appropriate methods of `AnimalDll_2013`. – Keith Payne Sep 03 '13 at 19:15
  • That did not work because the type was not expected. I figured out how to do it much faster and easier using AutoMapper.dll Thanks anyways Keith – user1867353 Sep 03 '13 at 20:20

1 Answers1

0

Used AutoMapper.dll... worked like a charm!

user1867353
  • 487
  • 1
  • 6
  • 12