Skip to content

Instantly share code, notes, and snippets.

@PadreSVK
PadreSVK / Startup.cs
Created Apr 12, 2021
DBContext registration with design time factory and usage of extension method GetConnectionString
View Startup.cs
using System;
using System.Text;
using BackgroundServices;
using BackgroundServices.HttpClients;
using BackgroundServices.Options;
using BL;
using DAL;
using DAL.Models.Identity;
using DAL.Query.Abstraction;
using DAL.Query.AllCity;
@PadreSVK
PadreSVK / DummyRepository.cs
Last active Apr 12, 2021
Dummy repository implementation
View DummyRepository.cs
public interface IRepository<TEntity, in TId>
where TEntity : IEntity<TId>
{
Task<TEntity> GetById(TId id);
Task Insert(TEntity entity);
Task Update(TEntity entity);
Task Remove(TId id);
}
public interface IEntity<TId>
@PadreSVK
PadreSVK / extensions.json
Last active Mar 31, 2021
Sample of recommended extensions in vscode
View extensions.json
{
"recommendations": [
"octref.vetur",
"editorconfig.editorconfig",
"streetsidesoftware.code-spell-checker",
"josefpihrt-vscode.roslynator",
"mushan.vscode-paste-image",
"davidanson.vscode-markdownlint",
"ionutvmi.path-autocomplete",
"ban.spellright",
@PadreSVK
PadreSVK / .editorconfig
Last active Mar 16, 2021
Lint xml from cmd via prettier
View .editorconfig
[*]
end_of_line = crlf
charset = utf-8-bom
[*.{appxmanifest,axml,build,config,csproj,dbml,discomap,dtd,json,jsproj,lsproj,njsproj,nuspec,proj,props,resjson,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]
indent_style=space
indent_size=2
tab_width=2
max_line_length=200
@PadreSVK
PadreSVK / Directory.Build.props
Last active Jan 6, 2021
Infrastructure for append git metadata
View Directory.Build.props
<Project>
<PropertyGroup>
<Copyright>© 2021 Paradajka Paprika</Copyright>
<Authors>Paradajka Paprika</Authors>
<Company>Paradajka Paprika</Company>
<StableVersionBranch>master</StableVersionBranch>
<RepositoryUrl>https://dev.azure.com/mysuperorganization/GitMetadataInfrastructure/_git/GitMetadataInfrastructure</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
@PadreSVK
PadreSVK / Directory.Build.props
Last active Dec 22, 2020
Combo of props + targets that add to dlls and nuget git metadata and source link support for pdb
View Directory.Build.props
<Project>
<PropertyGroup>
<StableVersionBranch>master</StableVersionBranch>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitInfo" Version="2.1.2" PrivateAssets ="All">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
@PadreSVK
PadreSVK / Directory.Build.targets
Last active Dec 14, 2020
Sample of .targets for solution wide additing git metadata dlls and autoincrement Versions based on GitVersion
View Directory.Build.targets
<Project>
<PropertyGroup>
<StableVersionBranch>master</StableVersionBranch>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersionTask" Version="5.5.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
@PadreSVK
PadreSVK / Directory.Build.props
Last active Dec 14, 2020
Sample of solution wide additing git metadata to dlls and additing nuget version suffix for non master branch
View Directory.Build.props
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<StableVersionBranch>master</StableVersionBranch>
<!-- this should be defined in every csproj - if is not filled dont have affect on functioniality (nuget metadata) -->
<!-- <RepositoryUrl>https://github.com/XXXXX.git</RepositoryUrl>-->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitInfo" Version="2.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
@PadreSVK
PadreSVK / Project.csproj
Last active Dec 12, 2020
Simple nuget autoincrement of nuget prerelease version based on branch policy
View Project.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>1.0.1</Version>
<MainVersionSchemeBranch>master</MainVersionSchemeBranch>
<RepositoryUrl>https://github.com/PadreSVK/plzen-2020-web-development.git</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitInfo" Version="2.1.2">
<PrivateAssets>all</PrivateAssets>
View jsconfig.json
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": [
"src/*"
]
}
}
}