Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize combination with linq

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how linq can be combined. Xiaobian thinks it is quite practical, so share it with you for reference. I hope you can gain something after reading this article.

I was misled before, saying that linq is how to realize the combination pinch? Because linq is pre-compiled drops, there is no way to spell a sql string out, let me tangle for a long time, but I think Microsoft people should be more powerful, so I am in line with the principle of "there are difficulties to go on, no difficulties to create difficulties," in the case of LINQ TO ADO. NET has not been familiar with, I think I decided to use ASP.NET MVC + ADO. NET EF in the recent independent completion of small projects. Most information systems have a composite query function, and I quickly used jquery to do so.

This form submits the combined condition to the background, and I'll wrap it into an array of condition objects:

publicclassCondition

{

///

///field

///

publicstringField{get;set;}

///

///expression

///

publicstringOperator{get;set;}

///

///Value

///

publicstringValue{get;set;}

///

///Relationship

///

publicstringRelation{get;set;}

///

///

///

///

///

///

///

///

publicstaticCondition[]BuildConditions(string[]fileds,

string[]operators,string[]values,string[]relations)

{

if(fileds==null||operators==null||values==null||relations==null)

{

returnnull;

}

Condition[]conditions=newCondition[fileds.Length];

try

{

for(inti=0;i0)

{

body=ConditonToExpression(conditions[0],parameter);

for(inti=1;ir.ResourceID);

count=result.Count();

returnresult

.Skip(first)

.Take(limit)

.ToList();

}

}

About "linq how to achieve combination" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report