要让程序能够访问到_Entity命名空间下的这些强类型查询对象,需要先使用Entity Configurator生成强类型实体查询代码。只需在Entity Configurator中载入实体程序集,设置要对应的元数据,点击工具的Code->Generate EntityQuery Code菜单项,再将生成的代码复制到需要的任意程序集中,生成的代码及包含了所有实体的强类型查询对象。
NBear的像类型实体查询语法支持的操作符有:&(与),|(或),==(等于),!=(不等于),>(大于),<(小与),>=(大于等于),<=(小于等于),!(否),以及.Like()注意,Like是一个函数,可以以_Entity.User.LoginId.Like("teddy")这样的方式使用。
对于OrderBy部分,唯一的可用操作符是&,即表示组合多个排序条件。
代码示例
下面的代码是使用Entity Configurator工具为使用Entity Configurator设置实体元数据、生成数据库创建脚本一文中所示的实体生成的强类型实体查询代码:
namespace _Entity
{
public class AgentUser
{
public static PropertyItem LoginId = new PropertyItem("LoginId", "[", "]", "@");
public static PropertyItem Id = new PropertyItem("Id", "[", "]", "@");
public static PropertyItem Name = new PropertyItem("Name", "[", "]", "@");
public static PropertyItem PrivilegeOwnerId = new PropertyItem("PrivilegeOwnerId", "[", "]", "@");
}
public class GhostUser
{
public static PropertyItem Id = new PropertyItem("Id", "[", "]", "@");
public static PropertyItem Name = new PropertyItem("Name", "[", "]", "@");
public static PropertyItem PrivilegeOwnerId = new PropertyItem("PrivilegeOwnerId", "[", "]", "@");
}
public class IdentableEntity
{
public static PropertyItem Id = new PropertyItem("Id", "[", "]", "@");
public static PropertyItem Name = new PropertyItem("Name", "[", "]", "@");
}
public class IdFactory
{
public static PropertyItem NextId = new PropertyItem("NextId", "[", "]", "@");
}
public class LocalUser
{
public static PropertyItem Password = new PropertyItem("Password", "[", "]", "@");
public static PropertyItem LoginId = new PropertyItem("LoginId", "[", "]", "@");
public static PropertyItem Id = new PropertyItem("Id", "[", "]", "@");
public static PropertyItem Name = new PropertyItem("Name", "[", "]", "@");
public static PropertyItem PrivilegeOwnerId = new PropertyItem("PrivilegeOwnerId", "[", "]", "@");
}
public class Loginable
{
public static PropertyItem LoginId = new PropertyItem("LoginId", "[", "]", "@");
}
public class PasswordLoginable
{
public static PropertyItem Password = new PropertyItem("Password", "[", "]", "@");
public static PropertyItem LoginId = new PropertyItem("LoginId", "[", "]", "@");
}
public class PrivilegeAssignable
{
public static PropertyItem PrivilegeOwnerId = new PropertyItem("PrivilegeOwnerId", "[", "]", "@");
}
public class User
{
public static PropertyItem Id = new PropertyItem("Id", "[", "]", "@");
public static PropertyItem Name = new PropertyItem("Name", "[", "]", "@");
public static PropertyItem PrivilegeOwnerId = new PropertyItem("PrivilegeOwnerId", "[", "]", "@");
}
public class UserGroup
{
public static PropertyItem Comment = new PropertyItem("Comment", "[", "]", "@");
public static PropertyItem Id = new PropertyItem("Id", "[", "]", "@");
public static PropertyItem Name = new PropertyItem("Name", "[", "]", "@");
public static PropertyItem PrivilegeOwnerId = new PropertyItem("PrivilegeOwnerId", "[", "]", "@");
}
}
相关推荐
.net编程里面的NBear2.5.0框架
** 请修改扩展名为ZIP Nbear V3.7.2源代码 类库 VS插件等
2、基于NBear的三层系统架构 3、总体设计 3.1 约定 3.1.1 程序集和命名空间 3.1.2 接口、类和枚举的命名约定 3.1.3 使用注释和代码区region 3.2 设计原则 3.2.1 数据库设计原则 3.2.2 应用程序设计原则 3.3 设计实现...
Nbear ORM 开源框架
NBear初始化时,便把configuration\connectionStrings节点下的所有数据库连接构建出来
NBear原名Ilungasoft Framework,是主要有Teddy开发的一个基于.Net 2.0 (C# 2.0, ASP.NET 2.0)的快速开发框架,她将使您基于.Net 2.0的web/winform/distributed开发变得异常高效、性能卓越。
封装对数据库的查询,低版本,高效率,有不懂可相互切磋
Nbear使用手册(版本: 2.4.1)
NBear的核心包括一个泛型、强类型的的数据持久化接口、一组接口式的Entity定义组件、高性能XML/JSON序列化支持、服务工厂、分布式服务队列和Web组件
ASP.NET-[论坛社区]NBear+NBear开发BBS系统源码.zip
使用NBear项目模板快速建立项目框架,通过这个模板你就像建.net项目一样,快速建立项目相关的文件上。NBear的相关配置文件,试一下你就知道了。
nbear框架的介绍
NBear是一个基于.Net 2.0、C#2.0开放全部源代码的的软件开发框架类库。NBear的设计目标是尽最大努力减少开发人员的工作量,最大程度提升开发效率,同时兼顾性能及可伸缩性。
NBear+NBear开发BBS系统源码_nbearbbs
最新的Nbear教程,另你可以1天之内学会Nbear。
NBear3.6.6,里面含源代码和各种工具。
NBear 开发平台源码与帮助文档 (附带案例)
NBear是一个基于.Net 2.0、C#2.0开放全部源代码的的软件开发框架类库。NBear的设计目标是尽最大努力减少开发人员的工作量,最大程度提升开发效率,同时兼顾性能及可伸缩性。
ASP.NET源码——[论坛社区]NBear+NBear开发BBS系统源码.zip