404*_*_ML 3 c# azure visual-studio-2010 visual-studio azure-web-roles
我正在尝试实现IUpdatable.
错误1'WebRole1.InfoManager'没有实现接口成员'System.Data.Services.IUpdatable.ClearChanges()'我得到的所有错误都说我没有实现所有接口成员,但我实现了一些并非全部.我没有把孔代码我希望你能理解.
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
}
}
Run Code Online (Sandbox Code Playgroud)
}
它是一个接口,因此您必须实现所有成员 - 无论您是否愿意.
在完整实现接口之前,此错误不会消失.你可以在你正在实现的方法的范围内做你想做的事情,比如甚至提出一个NotImplementedException例子 - 但这是你的实现,所以编译器很高兴.
我不会容忍无知(你还是应该学习的怎么样了和个为什么),但我会提供可以在你的学习帮助和小费如果不出意外,未来生产力:
在Visual Studio中,当您打开类代码文件来实现接口时,您可以让VS为您吐出代码...
class MyClass : IMyInterface // <- hover mouse and click the drop down that appears
Run Code Online (Sandbox Code Playgroud)
从下拉列表中,您应该看到该选项Implement Interface 'IMyInterface',单击它并vo!它会自动为您生成骨架方法体.
| 归档时间: |
|
| 查看次数: |
17367 次 |
| 最近记录: |