Code Monkey home page Code Monkey logo

bubdm / dmsframe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hailang2ll/dmsframe

0.0 0.0 0.0 7.39 MB

自研的一种ORM框架,DMS框架是采用LINQ的写法的一种数据库访问框架,此框架到目前为止运用的8年,都在各大的项目、各大公司运用过,非常的稳定;写法也是非常简单,只要SQL支持的DMS基本都支持,同时支持分库分表操作,支持mysql与mssql数据库,目前只支持.netfx

C# 35.25% PHP 0.42% HTML 5.89% CSS 4.53% JavaScript 50.84% Vim Snippet 0.14% ASP.NET 2.93%

dmsframe's Introduction

DMSFrame框架说明

DMS框架是采用LINQ的写法的一个数据库访问框架。具体使用与现有的LINQ写法差不多一致。

常用的写法

单列添加/修改/删除

Pro_FundCompany entity = new Pro_FundCompany()              
{              
		FundKey = Guid.NewGuid(),              
		FundName = param.FundName,              
		FundLogo = param.FundLogo,              
		FundDesc = string.IsNullOrWhiteSpace(param.FundDesc) ? string.Empty : param.FundDesc,              
		FundCode = param.FundCode,              
};              
新增              
return DMS.Create<T>().InsertIdentity(entity);              
编辑              
return DMS.Create<T>().Edit(entity, q=>q.id=id) > 0;              
删除              
return DMS.Create<T>().Delete(q=>q.id=id) > 0;              

集合查询:

DMS.Create<Pro_FundCompany>().Where(q => q.FundName == param.FundName && q.DeleteFlag == false).ToList();              

分页查询:

DMS.Create<T>().Where(q => q.VestName.Like(entity.VestName)&& q => q.VestType == entity.VestType)              
.OrderBy(q => q.OrderBy(q.CreateTime.Desc()))              
.Pager(entity.PageIndex, entity.PageSize)              
.ToConditionResult(entity.TotalCount);              

事物处理

DMSTransactionScopeEntity tsEntity = new DMSTransactionScopeEntity();              
编辑实体                                  
tsEntity.EditTS<Pro_ProductSpec, Pro_ProductMST>(x => new Pro_ProductSpec()              
{              
   ProductID = x.ProductID              
}, (x, y) => x.ProductKey == y.ProductKey && x.ProductKey == Guid.NewGuid(),"更新表数据库名称(默认为空)","条件表数据库名称(默认为空)");              
              
           
添加实体               
tsEntity.AddTS<Pro_ProductSpec, Pro_ProductMST>(product => new Pro_ProductSpec()              
{              
    ProductID = product.ProductID              
}, x => x.ProductID == 1000);              
              
新增实体        
DMS.Create<Pro_ProductSpec, Pro_ProductMST>.InsertSelect(product => new Pro_ProductSpec()              
{              
  ProductID = product.ProductID              
}, x => x.ProductID == 1000);              
                             
string errMsg = "";              
if (!new DMSTransactionScopeHandler().Update(tsEntity, ref errMsg))              
{              
  result.errno = 2;              
  result.errmsg = "失败," + errMsg;              
  return;              
}              

dmsframe's People

Contributors

githuer avatar hailang2ll avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.