This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var query = | |
from artId in artIds | |
join artIdArticle in _dbContext.DetArticle.Select(p => p.Artid) | |
on artId equals artIdArticle into outer | |
from itemArticle in outer.DefaultIfEmpty() | |
select new { artId, itemArticle }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select carrier.id , cc.car_id , rank (*) over (partition by carrier_id ORDER BY cc.created DESC) | |
from carrier.carrier carrier join carrier.carrier_car cc on carrier.id = cc.carrier_id | |
order by carrier.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Expression<Func<TEntity, bool>> CreateExpression<TEntity>(LambdaExpression baseLambda, Expression<Func<TEntity, bool>> filter) where TEntity : class | |
{ | |
var param = baseLambda.Parameters[0]; | |
var left = baseLambda.Body; | |
var right = filter.Body.ReplaceParameter(filter.Parameters[0], param); | |
var result = Expression.AndAlso(left, right); | |
return Expression.Lambda<Func<TEntity, bool>>(result, param); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#@ template debug="false" hostspecific="false" language="C#" #> | |
<#@ assembly name="System.Core" #> | |
<#@ assembly name="System.Xml" #> | |
<#@ import namespace="System.Linq" #> | |
<#@ import namespace="System.Text" #> | |
<#@ import namespace="System.IO" #> | |
<#@ import namespace="System.Xml" #> | |
<#@ import namespace="System.Collections.Generic" #> | |
<#@ output extension=".cs" #> | |
// Данный файл генерирует класс SampleDto в TextTemplate1.cs файле |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* по каждому производителю выбираем 3 топовых продукта | |
* смысл в том что producers.producerid - можем передавать в нижестоящий запрос либо в | |
* нижестоящую функцию возвращающую табличное значение | |
*/ | |
SELECT producers.*, productso.* | |
FROM producers | |
CROSS APPLY | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select prRemote.*,prLocal.* from [193.107.181.75].YstTerminal.dbo.Producers prRemote full outer join YstTerminal.dbo.Producers prLocal | |
on prRemote.Producerid=prLocal.Producerid | |
where prRemote.producerid is null or prLocal.ProducerId is null | |
/* | |
select count(*) from [193.107.181.75].YstTerminal.dbo.Producers | |
select count(*) from YstTerminal.dbo.Producers | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MemoryCacheManager | |
{ | |
#region Fields | |
private readonly IMemoryCache _cache; | |
/// <summary> | |
/// All keys of cache | |
/// </summary> | |
/// <remarks>Dictionary value indicating whether a key still exists in cache</remarks> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Такой аттрибут надо явно регистрировать в контейнере зависимостей | |
/// синтаксис использования [ServiceFilter(typeof(SomeActionFilter))] | |
/// </summary> | |
public class SomeActionFilter: ActionFilterAttribute | |
{ | |
private ApplicationDbContext _appDbContext; | |
public SomeActionFilter(ApplicationDbContext appDbContext) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddCors(); | |
// Add framework services. | |
services.AddDbContext<ApplicationDbContext>(options => | |
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); | |
services.AddIdentity<ApplicationUser, IdentityRole>() | |
.AddEntityFrameworkStores<ApplicationDbContext>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* usage | |
* ключи обязательно должны быть id или name полей | |
если не указаны - отображается только ValidationSummary | |
showErrors($form, | |
{ | |
"Email": "bad email", | |
"CompanyName": "bad company name" | |
} | |
); |
NewerOlder