Categories

See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Error when Implementing Interface: class doesn't implement interface members

General Tech Learning Aids/Tools

Max. 2000 characters
Tuteehub
Replies

usr_profile.png

User

( 5 months ago )

 

I am trying to implements the IUpdatable.

Error 1 'WebRole1.InfoManager' does not implement interface member 'System.Data.Services.IUpdatable.ClearChanges()' All the errors i get are saying that i am not implementing all interface members, but i implements some not all of course. I didn't put the hole code I hope that you can understand.

  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Data.Services;
  using Microsoft.WindowsAzure;
  using Microsoft.WindowsAzure.ServiceRuntime;
  using Microsoft.WindowsAzure.StorageClient;

  namespace WebRole1
  {
     public class InfoManager : IUpdatable
     {
      private TableServiceContext context;

    // To Generate DataConnectionString and svcClient
    private TableServiceContext GetContext()
    {
    //Implemented code
    }

    public CommentManager()
    {
        context = GetContext();
    }


    // To get my table infos
    public IQueryable<Info> Infos
    {
        get
        {
            return context.CreateQuery<Info>("Infos").AsTableServiceQuery();
        }
    }
   // Creating the resource and cheking the compatibility of the type and do an add Object 

    public Object CreateResource(string containerName, string fullTypeName)
    {
        //Implemented Code
    }

    // Return the instance of the resource represented by the object 
    public Object ResolveResource(Object resource)
    {
        return resource;
    }

    public void SaveChanges()
    {
        context.SaveChangesWithRetries();
    }

    public void setValue(Object targetResource, string propertyName, Object propertyValue)
    {
    //Implemented Code
    }

}

usr_profile.png

User

( 5 months ago )

 

It's an interface, therefore you MUST implement all members - whether you want to, or not.

This error will not go away until you implement the interface in its entirety. You can do what you want within the scope of the method you're implementing, say even raising a NotImplementedException for instance - but that is your implementation so the compiler is happy.

I won't condone ignorance (you should still learn the hows and whys) but I will offer a tip which may aid in your learning and, if nothing else, future productivity:

From within Visual Studio, when you have the class code file open which is to implement the interface then you can have VS spit out the code for you...

class MyClass : IMyInterface // <- hover mouse and click the drop down that appears

From the drop down you should see the option Implement Interface 'IMyInterface', click it and voilà! It will automatically generate the skeletal method bodies for you.

what's your interest


forum_ban8_5d8c5fd7cf6f7.gif