Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/153.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Activerecord RIA域服务&x2B;活动记录_Activerecord_Subsonic3 - Fatal编程技术网

Activerecord RIA域服务&x2B;活动记录

Activerecord RIA域服务&x2B;活动记录,activerecord,subsonic3,Activerecord,Subsonic3,我尝试在使用.NET RIA服务的SL3项目中使用SubSunsonic.ActiveRecord。 然而,当我试图在DomainService类中返回一些IQuerable时,我得到一个错误,即亚音速生成的类有一个属性“Columns”,其类型不受支持。 这就是我所拥有的 public IEnumerable<SE_NorthWind.SuperEmployee> GetIntegers() { return SE_NorthWind.SuperEmployee.All()

我尝试在使用.NET RIA服务的SL3项目中使用SubSunsonic.ActiveRecord。 然而,当我试图在DomainService类中返回一些IQuerable时,我得到一个错误,即亚音速生成的类有一个属性“Columns”,其类型不受支持。 这就是我所拥有的

public IEnumerable<SE_NorthWind.SuperEmployee> GetIntegers()
{
  return SE_NorthWind.SuperEmployee.All()
    .Where(emp => emp.Issues > 100)
    .OrderBy(emp => emp.EmployeeID);
}
知道怎么办吗?我真的不想使用Linq到SQL:)

Thx

p.S.刚刚尝试从亚音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速音速

Error   4   The entity 'SE_NorthWind.SuperEmployee' does not have a key defined. Entities exposed by DomainService operations must have must have at least one property marked with the KeyAttribute.   SuperEmployee
当然,SuperEmployee表有一个主键,因为亚音速生成的类可以看到它

...
Columns.Add(new DatabaseColumn("EmployeeID", this)
            {
                IsPrimaryKey = true,
                DataType = DbType.Int32,
                IsNullable = false,
                AutoIncrement = true,
                IsForeignKey = false,
                MaxLength = 0
            });
...

但是RIA对象需要一些属性。我想我将不得不使用原生Linq to SQL,直到亚音速适应所有这些:(

来回答问题的第二部分

您需要将“KeyAttribute”添加到“EmployeeId”属性的PrimaryKey属性中。 该属性位于“System.ComponentModel.DataAnnotations”命名空间中

在Sub-Sonic 3上没有更新,但是您可以更改基础模板来生成它,或者更改Sub-Sonic引擎并将其作为补丁提交

我在用SilverLight 3和Raisservices跑步


希望这能有所帮助。

能否尝试删除[EnableClientAccess()]属性以查看项目是否将生成

...
Columns.Add(new DatabaseColumn("EmployeeID", this)
            {
                IsPrimaryKey = true,
                DataType = DbType.Int32,
                IsNullable = false,
                AutoIncrement = true,
                IsForeignKey = false,
                MaxLength = 0
            });
...