. net IQueryable:期望的类、委托、枚举、接口错误
本文关键字:委托 枚举 接口 错误 IQueryable 期望 net | 更新日期: 2023-09-27 17:50:23
我是。net和windows azure的新手,并试图遵循本教程:http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_introtowindowsazurelabvs2010_topic2.aspx
当我尝试如下声明IQueryable属性时:
public IQueryable<C1_Schema> C1_Schema
{
get
{
return this.CreateQuery<C1_Schema>("C1_Schema");
}
}
I得到一个错误:错误期望类,委托,枚举,接口,结构
这是我声明属性
的类public IQueryable<C1_Schema> C1_Schema
{
get
{
return this.CreateQuery<C1_Schema>("C1_Schema");
}
}
public class context : Microsoft.WindowsAzure.StorageClient.TableServiceContext
{
public context(string baseAddress, Microsoft.WindowsAzure.StorageCredentials credentials)
: base(baseAddress, credentials)
{ }
}
C1_Schema类:
public class C1_Schema : Microsoft.WindowsAzure.StorageClient.TableServiceEntity
{
public String fname { get; set; }
public String lname { get; set; }
public double salary { get; set;}
public C1_Schema()
{
PartitionKey = DateTime.UtcNow.ToString("MMddyyyy");
// Row key allows sorting, so we make sure the rows come back in time order.
RowKey = string.Format("{0:10}_{1}", DateTime.MaxValue.Ticks - DateTime.Now.Ticks, Guid.NewGuid());
}
}
感谢你的帮助。
您试图在类之外声明该属性。在c#中,一切都必须在一个类中。
移动属性的文本,像这样:
public class context : Microsoft.WindowsAzure.StorageClient.TableServiceContext
{
public IQueryable<C1_Schema> C1_Schema
{
get
{
return this.CreateQuery<C1_Schema>("C1_Schema");
}
}
}
我建议你先学习一些基本的c#教程,然后再尝试做一些像这样特定于库的事情。