This document now exists on the official ASP.NET core docs page.
- Application
- Request Handling
This document now exists on the official ASP.NET core docs page.
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp2.2</TargetFramework> | |
<RootNamespace>EFCoreEnums</RootNamespace> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" /> |
using System; | |
using System.Numerics; | |
namespace Common | |
{ | |
/// <summary> | |
/// Arbitrary precision decimal. | |
/// All operations are exact, except for division. Division never determines more digits than the given precision. | |
/// Source: https://gist.github.com/JcBernack/0b4eef59ca97ee931a2f45542b9ff06d | |
/// Based on https://stackoverflow.com/a/4524254 |
--from SO: http://stackoverflow.com/questions/5873170/generate-class-from-database-table | |
declare @TableName sysname = 'TableName' | |
declare @Result varchar(max) = 'public class ' + @TableName + ' | |
{' | |
select @Result = @Result + ' | |
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; } | |
' | |
from |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Text; | |
using System.Threading.Tasks; | |
/// <summary> | |
/// An async alternative to System.IO.File common usages | |
/// </summary> | |
public static class FileAsync |
Update 2022: git checkout -p <other-branch>
is basically a shortcut for all this.
FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.
Example: You have a branch refactor
that is quite different from master
. You can't merge all of the
commits, or even every hunk in any single commit or master will break, but you have made a lot of
improvements there that you would like to bring over to master.
Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.