大家帮我看看这个sliverlight3.0 ria的问题.

ericloot 2010-03-03 12:09:04
我按照正常的流程在web项目下添加ADO.NET Entity Data Model模版
1 .添加一个实体xxx,编译会提示"错误11007 实体类型xxx未映射".这个什么意思?
2 .通过"数据库更新模型",添加一张表table1到edmx,没问题.
3 .数据库里有一个存储过程名为pro1,语句为"select * from table1",通过"数据库更新模型"添加这个pro1到edmx.然后在edmx以函数导入的方式指定实体为table1.这也没问题.
4.在数据库里建立一个存储过程名为pro12,语句为"select * from table1,table2",通过"数据库更新模型"添加这个pro12到edmx.我怎么导入到实体上? 我数据库里没有包含这些字段的表.而1中我为之建立包含所有table1,2所有字段的实体xxx,正显示未映射. 我怎么解决这个问题.


...全文
123 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ericloot 2010-03-04
  • 打赏
  • 举报
回复
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="MessageModel", Name="SuperEmployee")]
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
[global::System.Serializable()]
public partial class SuperEmployee : global::System.Data.Objects.DataClasses.EntityObject
{
/// <summary>
/// 创建新的 SuperEmployee 对象。
/// </summary>
/// <param name="id">ID 的初始值。</param>
public static SuperEmployee CreateSuperEmployee(int id)
{
SuperEmployee superEmployee = new SuperEmployee();
superEmployee.ID = id;
return superEmployee;
}
/// <summary>
/// 架构中不存在属性 ID 的注释。
/// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()]
public int ID
{
get
{
return this._ID;
}
set
{
this.OnIDChanging(value);
this.ReportPropertyChanging("ID");
this._ID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
this.ReportPropertyChanged("ID");
this.OnIDChanged();
}
}
private int _ID;
partial void OnIDChanging(int value);
partial void OnIDChanged();
}
ericloot 2010-03-04
  • 打赏
  • 举报
回复
实体代码是自动生成的啊

[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="MessageModel", Name="SuperEmployee")]
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
[global::System.Serializable()]
public partial class SuperEmployee : global::System.Data.Objects.DataClasses.EntityObject
{
/// <summary>
/// 创建新的 SuperEmployee 对象。
/// </summary>
/// <param name="id">ID 的初始值。</param>
public static SuperEmployee CreateSuperEmployee(int id)
{
SuperEmployee superEmployee = new SuperEmployee();
superEmployee.ID = id;
return superEmployee;
}
/// <summary>
/// 架构中不存在属性 ID 的注释。
/// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()]
public int ID
{
get
{
return this._ID;
}
set
{
this.OnIDChanging(value);
this.ReportPropertyChanging("ID");
this._ID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
this.ReportPropertyChanged("ID");
this.OnIDChanged();
}
}
private int _ID;
partial void OnIDChanging(int value);
partial void OnIDChanged();
}


我只是在edmx这个界面上添加实体,就自动生成的代码!
jv9 2010-03-04
  • 打赏
  • 举报
回复
你的实体代码是什么?是不是定义的有问题?
可以参考这个实体代码例子:


public class SuperEmployee{
[ReadOnly(true)]
[Key]
public int EmployeeID { get; set; }
}


实体定义成功后,使用domain service和数据层进行通讯获取数据。

8,744

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧