惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 三生石上(FineUI控件)
月光博客
月光博客
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队
Stack Overflow Blog
Stack Overflow Blog
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
宝玉的分享
宝玉的分享
A
About on SuperTechFans
Vercel News
Vercel News
P
Proofpoint News Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 【当耐特】
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
Visual Studio Blog
Jina AI
Jina AI
Y
Y Combinator Blog
T
Tailwind CSS Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI

博客园 - leegool

常见XSD问题 抗投诉空间 C#用WebClient下载File时操作超时的问题 用C# 实现 Zen Cart 的用户密码加密算法 ASP.NET MVC 3 新特性 ASP.NET MVC 局部缓存实现 用户控件缓存 Partial Output Caching - leegool System.Web.Security.SqlMembershipProvider”要求一个与架构版本“1”兼容的数据库架构。 关于MarshalByRefObject的解释 MVC upload image MVC上传图片的例子 - leegool jQuery Custom Selector JQuery自定义选择器 - leegool 清楚浏览器缓存 Overview of Full Text Stop Words(MSSQL全文索引的干扰词概括)MSSQL 全文索引的最小单词长度 JQuery性能优化 MS SQL 事务隔离级别 认识ASP.NET 中的 AppDomain 国外服务器上 中文成 显示乱码 Sharing cookie Across domain 跨域cookie访问 cookie跨域 web性能优化(最佳) EntitySpaces 2009 Trial Expire 异常
EntitySpace 常用语句
leegool · 2015-04-06 · via 博客园 - leegool

EntitySpace 这个是很早期的ORM框架,最近发现这个破解的也都不能用了。有谁知道能用的,联系我。

1. where带几个条件的 

query.Where(query.ProductTempStatus.Equal((int)tempStatus) | query.ProductStatus.Equal((int)status));

 query.Where(query.ProductTempStatus.Equal((int)tempStatus) && query.ProductStatus.Equal((int)status));

2. 批量更新的:

 public bool UpdateProductTempStatusBatch(List<int> productIds,ProductTempStatus status)
        {
            try
            {


                AwhProducts product = new AwhProducts();
                AwhProductsCollection products = new AwhProductsCollection();
                AwhProductsQuery query = new AwhProductsQuery();

                query.Where(query.ProductID.In(productIds));

                products.Load(query);

                foreach (var item in products)
                {
                    item.ProductTempStatus = (int)status;
                }

                products.Save();

                return true;

            }
            catch (Exception ex)
            {
                return false;
            }

        }

3. 使用事务

//MYSQL的事务语句无效

 using (esTransactionScope scope = new esTransactionScope())
 {

...

...

 product.Save();

brand.Save();

scope.Complete();

}

其它事务的用法:

 using (esTransactionScope noTrans = new esTransactionScope(esTransactionScopeOption.Suppress))

 using (esTransactionScope rootTrans2 = new esTransactionScope(esTransactionScopeOption.RequiresNew))

查看这里:

http://www.entityspaces.net/blog/CategoryView,category,Transactions.aspx

4.人工执行SQL语句

esUtility util = new esUtility();
int count = (int)util.ExecuteScalar(esQueryType.Text, "Select Count(*) From Employees");