我目前正在测试VITA: Application Framework并且有一个名为公司的实体。公司可以拥有子公司,例如不同的办公室/商店,但我只想在列表中的母公司。
到目前为止,我有以下内容从数据库中获取记录,但where子句给了我这个错误
Unknown column 't0$.*' in 'where clause'
获取母公司的代码
DatabaseConfig.Configure(ConfigurationManager.ConnectionStrings("Context").ConnectionString)
Dim rbApp = DatabaseConfig.App
Dim dbSession = rbApp.OpenSession()
Dim companies As IList(Of ICompany) = dbSession.EntitySet(Of ICompany).Where(Function(w) w.Parent Is Nothing).ToList()
以下是公司界面
<Entity, ClusteredIndex("CreatedOn,Id")>
Public Interface ICompany
<PrimaryKey, Auto>
Property Id() As Guid
<Auto(AutoType.CreatedOn)>
Property CreatedOn() As DateTime
<Size(200), Index>
Property Name() As String
<Size(100), Nullable>
Property Telephone() As String
<Size(100), Nullable>
Property Mobile() As String
<Size(100), Nullable>
Property Fax() As String
<Size(250), Nullable>
Property Email() As String
<Nullable>
Property DeleteOn() As DateTime?
<OneToMany(), Nullable>
Property Parent() As ICompany
<OrderBy("Name:DESC")>
Property Children() As IList(Of ICompany)
End Interface
答案 0 :(得分:0)
不是VITA的错误。我删除了OneToMany属性,查询按预期工作。