0

I have a generic interface defined as following:

interface INewRegionBoarding<T> where T: class
{
    bool Create(T objectName);
    bool ValidateData(T objectName);
}

Then, I have a class implementing it:

public class ESafeActionService<T>: INewRegionBoarding<T>
{
    public bool ValidateData(EsafeActons eSafe)
    {
        if (String.IsNullOrEmpty(eSafe.Corporation)) return false;
        if (String.IsNullOrEmpty(eSafe.Region))
        {
            return false;
        }
        else if (eSafe.Region.Length != 2)
        {
            return false;
        }

        return true;
    }

       public bool Create(EsafeActons eSafe)
       {
           return eSafe.Create(eSafe.Corporation, eSafe.Region, eSafe.PortfolioName);
       }
    }

When building it, I have the following error:

'ESafeActionService<EsafeActions>' does not implement interface member INewRegionBoarding<EsafeActions>.ValidateData(EsafeActions)'

This is the ESafeAction class definition:

public class EsafeActons {

private string corporation;
private string region;
private string portfolioName;

public EsafeActons(string corporation, string region, string portfolioName)
{
    this.corporation = corporation;
    this.region = region;
    this.portfolioName = portfolioName;
}


public string Corporation
{
    get { return this.corporation; }
    set { this.corporation = value; }
}

public string Region
{
    get{return this.corporation;}
    set { this.region = value; }
}

public string PortfolioName
{
    get { return this.corporation; }
    set { this.portfolioName = value; }
}

public bool Create(string corporation, string region, string portfolioName)
{
    //call stored proc
    return true;
}

}

I'm not really sure what I'm doing wrong.

Thank's

1
  • Which language? Please update question to add the tag of the language Commented Oct 28, 2014 at 21:58

1 Answer 1

2

I'm not really sure what I'm doing wrong

You're keeping the class generic but implementing the interface with a specific type. Change your class definition to:

public class ESafeActionService: INewRegionBoarding<EsafeActons>
{
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.