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
BEGIN TRANSACTION | |
GO | |
CREATE PROCEDURE FetchObjectsWithMetadata | |
@SortBy NVARCHAR(50), | |
@PageSize INT = 10, | |
@PageNumber INT, | |
@NameFilter NVARCHAR(256) | |
AS | |
BEGIN |
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
begin transaction; | |
create table Location | |
( | |
Id int primary key, | |
City varchar(255), | |
[State] char(2), | |
Zip char(5) unique, | |
); |
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.Data.SqlClient; | |
namespace database_test_runner | |
{ | |
public class SQL : IDisposable | |
{ | |
private readonly SqlConnection _connection; | |
public SQL() | |
{ |
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
// Change this to your project namespace | |
using Sample.Shared; | |
var CorsPolicyName = "MyCorsApiPolicy"; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Services.AddCors(options => | |
{ | |
options.AddPolicy(name: CorsPolicyName, policy => | |
{ |
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
DROP FUNCTION IF EXISTS ConnectionString; | |
GO | |
CREATE FUNCTION ConnectionString(@includeProperties bit = 1) | |
RETURNS nvarchar(1000) | |
AS | |
BEGIN | |
-- Retrieve server name | |
DECLARE @hostName nvarchar(128); | |
SET @hostName = CAST(host_name() AS nvarchar(128)); |
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 BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Engines; | |
using BenchmarkDotNet.Running; | |
_ = BenchmarkRunner.Run<TestParamType>(); | |
[MemoryDiagnoser] | |
public class TestParamType | |
{ | |
private List<string> list = new(); |
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
;WITH types AS | |
( | |
SELECT system_type_id, | |
CASE | |
WHEN system_type_id IN (34, 35, 99, 173, 165, 167, 175, 231, 239) THEN 'string' | |
WHEN system_type_id IN (36, 189) THEN 'Guid' | |
WHEN system_type_id IN (48) THEN 'byte' | |
WHEN system_type_id IN (52) THEN 'short' | |
WHEN system_type_id IN (56) THEN 'int' | |
WHEN system_type_id IN (58, 61) THEN 'DateTime' |
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.SqlServer.TransactSql.ScriptDom; | |
public static class SqlUtilities | |
{ | |
public static string GetDotnetType(this SqlDataTypeOption sqlDataType, bool isNullable = false) | |
{ | |
if (IsUnsupportedType()) | |
{ | |
return string.Empty; | |
} |
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 interface IAccount | |
{ | |
int Balance { get; } | |
void Deposit(int amount); | |
void Withdraw(int amount); | |
event EventHandler<int> BalanceChanged; | |
event EventHandler<int> Overdraft; | |
} |
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 recommended DB option | |
ALTER DATABASE CURRENT SET MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT=ON; | |
GO | |
-- validate tier | |
IF (DatabasePropertyEx(DB_Name(), 'IsXTPSupported') = 0) | |
BEGIN | |
PRINT 'This database does not support in-mem database.' |
NewerOlder