Preface
I have been diving in the blog park for two or three years, I have seen a lot of great God's articles here, and learned a lot of things. It can be said that I am learning from the blog Garden Nutrition growth.
Think that year, I also take 10 g of spiritual food from a blog park great God there for a set of development framework, formally embarked on the development of the road, to later become the main development, and then to the project manager and then successfully won the art sister, also be on the peak of life.
Only take, do not share is selfish, we are so selfish how to do technical exchanges, said to share the first thought is my 120G of spiritual food, but to share this seems to have a legal risk, so I have a few years in the. NET development career accumulated a set of framework to share.
I sent a blog in the morning and let the admin take it away for a while. Here I explain completely no advertising means, I will not place any promotional information, not that necessary, the house, car, sister have, in a good unit on the class, or not this xianxin to do what open source framework, the purpose is to have, is to come out and put a force in front of the novice. Let's go down the code and see if there's a little ad in there. My small JJ automatically shortens one centimeter.
Talk less, first to introduce the development framework.
Frame name: Nfine.framwork, cool frame, good frame
Framework use scenarios: OA, ERP, BPM, CRM, WMS, TMS, MIS and other business management systems and background system Framework solutions:
Solution Introduction:
1, Nfine.code Bottom core class (not involved in development, can be compiled into DLLs provided).
2, Nfine.data data layer (not involved in development, can be compiled into DLLs provided).
3, Nfine.application application (a bit similar to the business Logic layer)
4, nfine.domain field layer.
5, nfine.mapping database mapping.
6, nfine.repository data access.
7, Nfine.web front-end view and controller. The main application of the framework technology:
1, front-end technology
JS framework: jquery-2.1.1, Bootstrap.js, jquery UI
CSS framework: Bootstrap v3.3.4 (stability is the background, the UI aspects of the change according to the needs of their own upgrade it).
Client authentication: JQuery Validation Plugin 1.9.0.
Online Editor: CKEditor, Simditor
Upload file: uploadify v3.2.1
Dynamic page sign: jerichotab (self-improvement)
Data table: Jqgrid, Bootstrap Talbe
dialog box: layer-v2.3
Dropdown selection Box: JQuery Select2
Tree structure controls: jquery Ztree, jquery wdtree
Page layout: Jquery.layout.js 1.4.4
Chart plug-ins: Echarts, Highcharts
Date control: My97datepicker
2, back-end technology
Core framework: ASP.net MVC5, WEB API
Persistence Layer Frame: EntityFramework 6.0
Timed schedule tasks: quartz.net components
Security Support: Filters, SQL injection, request forgery
Server-side validation: Entity model validation, Self encapsulation Validator
Caching framework: Microsoft's own cache, Redis
Log management: log4net, login log, operation log
Tools: Npoi, Newtonsoft.json, CAPTCHA, rich public similar frame code style:
Database, Warehouse code
Using Nfine.code;
Using System;
Using System.Collections.Generic;
Using System.Data.Common;
Using System.Linq;
Using System.Linq.Expressions; namespace Nfine.data {///<summary>///warehousing interface///</summary>///<typeparam name= "tentity" & gt; entity type </typeparam> public interface irepositorybase<tentity> where Tentity:class,new () {in
T Insert (tentity entity);
int Insert (list<tentity> entitys);
int Update (tentity entity);
int Delete (tentity entity);
int Delete (expression<func<tentity, bool>> predicate);
Tentity findentity (object keyvalue);
Tentity findentity (expression<func<tentity, bool>> predicate);
Iqueryable<tentity> IQueryable ();
Iqueryable<tentity> IQueryable (expression<func<tentity, bool>> predicate);
List<tentity> findlist (string strSQL); List<tentity> findlist (String strSQL, DbparametEr[] dbparameter);
List<tentity> findlist (pagination pagination);
List<tentity> findlist (expression<func<tentity, bool>> predicate, Pagination Pagination); }
}
Using Nfine.code;
Using System;
Using System.Collections.Generic;
Using System.Data.Common;
Using System.Data.Entity;
Using System.Linq;
Using System.Linq.Expressions;
Using System.Reflection;
Using System.Text.RegularExpressions; namespace Nfine.data {///<summary>///warehousing implementation///</summary>///<typeparam name= "tentity" & Gt;</typeparam> public class repositorybase<tentity>: irepositorybase<tentity> where Tentity:clas
S,new () {public Nfinedbcontext DbContext = new Nfinedbcontext (); public int Insert (tentity entity) {DbContext. Entry<tentity> (entity).
state = entitystate.added; Return DbContext.
SaveChanges ();
public int Insert (list<tentity> entitys) {foreach (var entity in Entitys) {DbContext. Entry<tentity> (entity).
state = entitystate.added; Return DbContext. SaveChanges ();
public int Update (tentity entity) {DbContext. Set<tentity> ().
Attach (entity); Propertyinfo[] Props = entity. GetType ().
GetProperties (); foreach (PropertyInfo prop in props) {if (Prop. GetValue (entity, NULL)!= null) {if (Prop. GetValue (entity, NULL). ToString () = " ") DbContext. Entry (entity). Property (Prop. Name).
CurrentValue = null; DbContext. Entry (entity). Property (Prop. Name).
IsModified = true; } return DbContext.
SaveChanges (); public int Delete (tentity entity) {DbContext. Set<tentity> ().
Attach (entity); DbContext. Entry<tentity> (entity).
state = entitystate.deleted; Return DbContext.
SaveChanges ();
public int Delete (expression<func<tentity, bool>> predicate) { var entitys = DbContext. Set<tentity> (). Where (predicate).
ToList (); Entitys. ForEach (M => dbcontext. Entry<tentity> (M).
state = entitystate.deleted); Return DbContext.
SaveChanges (); Tentity findentity (Object keyvalue) {return dbcontext. Set<tentity> ().
Find (KeyValue); Tentity findentity (expression<func<tentity, bool>> predicate) {return db Context. Set<tentity> ().
FirstOrDefault (predicate); Public iqueryable<tentity> IQueryable () {return dbcontext.
Set<tentity> ();
Public iqueryable<tentity> IQueryable (expression<func<tentity, bool>> predicate) { Return DbContext. Set<tentity> ().
Where (predicate); List<tentity> findlist (String strSQL) {return dbcontext. Database.sqlquery<tEntity> (strSQL).
Tolist<tentity> (); List<tentity> findlist (String strSQL, dbparameter[] dbparameter) {return Dbcon Text. Database.sqlquery<tentity> (strSQL, DbParameter).
Tolist<tentity> (); Public list<tentity> findlist (pagination pagination) {bool ISASC = Pagination.sord.To Lower () = = "ASC"?
True:false;
string[] _order = Pagination.sidx.Split (', ');
Methodcallexpression resultexp = null; var tempdata = DbContext. Set<tentity> ().
AsQueryable ();
foreach (string item in _order) {string _orderpart = Item;
_orderpart = Regex.Replace (_orderpart, @ "\s+", "");
string[] _orderarry = _orderpart.split (");
String _orderfield = _orderarry[0];
bool sort = ISASC;
if (_orderarry.length = = 2) { ISASC = _orderarry[1]. ToUpper () = = "ASC"?
True:false;
var parameter = Expression.parameter (typeof (Tentity), "T"); var property = typeof (Tentity).
GetProperty (_orderfield);
var propertyaccess = expression.makememberaccess (parameter, property);
var orderbyexp = Expression.lambda (propertyaccess, parameter); Resultexp = Expression.call (typeof (Queryable), Isasc? "By": "OrderByDescending", new type[] {typeof (Tentity), property.
PropertyType}, Tempdata.expression, Expression.quote (orderbyexp));
} TempData = tempdata.provider.createquery<tentity> (RESULTEXP);
Pagination.records = Tempdata.count (); TempData = tempdata.skip<tentity> (Pagination.rows * (pagination.page-1)). Take<tentity> (pagination.rows).
AsQueryable ();
return Tempdata.tolist (); } public list<tentity> Findlist (expression<fUnc<tentity, bool>> predicate, pagination pagination) {bool ISASC = Pagination.sord.ToLower ( ) = = "ASC"?
True:false;
string[] _order = Pagination.sidx.Split (', ');
Methodcallexpression resultexp = null; var tempdata = DbContext. Set<tentity> ().
Where (predicate);
foreach (string item in _order) {string _orderpart = Item;
_orderpart = Regex.Replace (_orderpart, @ "\s+", "");
string[] _orderarry = _orderpart.split (");
String _orderfield = _orderarry[0];
bool sort = ISASC; if (_orderarry.length = = 2) {ISASC = _orderarry[1]. ToUpper () = = "ASC"?
True:false;
var parameter = Expression.parameter (typeof (Tentity), "T"); var property = typeof (Tentity).
GetProperty (_orderfield); var propertyaccess = ExpresSion.
Makememberaccess (parameter, property);
var orderbyexp = Expression.lambda (propertyaccess, parameter); Resultexp = Expression.call (typeof (Queryable), Isasc? "By": "OrderByDescending", new type[] {typeof (Tentity), property.
PropertyType}, Tempdata.expression, Expression.quote (orderbyexp));
} TempData = tempdata.provider.createquery<tentity> (RESULTEXP);
Pagination.records = Tempdata.count (); TempData = tempdata.skip<tentity> (Pagination.rows * (pagination.page-1)). Take<tentity> (pagination.rows).
AsQueryable ();
return Tempdata.tolist (); }
}
}
Automatically map object entities
Frame interface display:
Supports multiple skin transitions
Next for you to explain how to achieve dynamic skin switching Summary:
1: This article does not explain the implementation mechanism in detail.
2: This article does not explain the development method in detail.
But, at least you can: look at the source code, look at the API, see demo, you can also join the technical Exchange group to share.
Of course, follow-up I will supplement the relevant articles, more detailed and perfect mechanism and development methods. If you support the spirit of open source, on the spiritual level can be a point of praise to encourage Additional : There are bugs and vulnerabilities, please submit in private
1, Source download address: http://download.csdn.net/download/mss359681091/9947159
2, matching T4 template generated address:
Source: http://www.cnblogs.com/huanglin/