This file contains hidden or 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 enum EventType | |
| { | |
| //Примитивы событий на уровне бд | |
| Unchanged = 1, | |
| Delete = 2, | |
| Update, | |
| Add, | |
| Archive, | |
| None, | |
| SoftDelete |
This file contains hidden or 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 abstract class BaseContext : DbContext | |
| { | |
| public BaseContext(DbContextOptions options) : base(options) | |
| { | |
| } | |
| public override async Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = new CancellationToken()) | |
| { |
This file contains hidden or 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
| Func<int, Task<string>> newAction = async (item) => | |
| { | |
| Console.WriteLine($"Task #{item} started"); | |
| string content; | |
| using (HttpClient client = new()) | |
| { | |
| using HttpResponseMessage result = await client.GetAsync("https://ya.ru"); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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> |
NewerOlder