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
using System.Diagnostics; | |
using UnityEditor; | |
public static class PowerShellOpener | |
{ | |
[MenuItem("Tools/PowerShell")] | |
private static void NewMenuOption() | |
{ | |
var process = new ProcessStartInfo("powershell.exe") | |
{ |
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
using UnityEditor; | |
using UnityEngine; | |
public class AsepriteUnityImporter : AssetPostprocessor | |
{ | |
static void OnPostprocessAllAssets( | |
string[] importedAssets, | |
string[] deletedAssets, | |
string[] movedAssets, | |
string[] movedFromAssetPaths) |
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
using Microsoft.Extensions.DependencyInjection; | |
using System; | |
using Xunit; | |
namespace UnitTests | |
{ | |
public class ActivatorUtilitiesConstructorTests | |
{ | |
public class Dependency1 { } |
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
class Foo | |
{ | |
public static void Bar<TZoom>(TZoom zoom) where TZoom : IZoom { } | |
public static void Bar<TBoom, TLoom>(TBoom boom) where TBoom : IBoom<TLoom> { } | |
} | |
interface IZoom { } | |
interface IBoom<T> { } | |
class Zoom1 : IZoom { } |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<ItemGroup> | |
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo"> | |
<_Parameter1>$(AssemblyName).Tests</_Parameter1> | |
</AssemblyAttribute> | |
</ItemGroup> | |
</Project> |
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
services.AddSingleton<IConfigureOptions<HttpClientFactoryOptions>>(provider => | |
{ | |
return new ConfigureNamedOptions<HttpClientFactoryOptions>(name: null, options => | |
{ | |
options.HttpMessageHandlerBuilderActions.Add(builder => | |
{ | |
builder.AdditionalHandlers.Add(provider.GetRequiredService<YourHandler>()); | |
}); | |
}); | |
}); |
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
// Configure all named options without dependencies. | |
services.ConfigureAll<TOptions>(options => | |
{ | |
// Set your options here. | |
}); | |
// Configure all named options with dependencies. | |
// Setting name to null is a key here. | |
services.AddSingleton<IConfigureOptions<TOptions>>(provider => | |
{ |
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
// NuGet Microsoft.AspNet.Cors (5.2.7) | |
public class Startup | |
{ | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddCors(options => | |
options.AddDefaultPolicy(builder => | |
builder | |
.AllowAnyOrigin() // .WithOrigins(...) if .AllowCredentials | |
.AllowAnyMethod() |
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
[Theory] | |
[InlineData("Development")] | |
public async Task CallSwaggerEndpoint_ShouldReturnHttpOk(string environment) | |
{ | |
// Arrange | |
using var sut = await Program.CreateHostBuilder(null) | |
.UseEnvironment(environment) | |
.UseDefaultServiceProvider((context, options) => | |
{ |
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 schema_name(tab.schema_id) as schema_name, | |
tab.name as table_name, | |
col.column_id, | |
col.name as column_name, | |
t.name as data_type, | |
col.max_length, | |
col.precision | |
from sys.tables as tab | |
inner join sys.columns as col | |
on tab.object_id = col.object_id |
OlderNewer