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
// add IdentityModel.AspNetCore package | |
using Microsoft.Extensions.DependencyInjection; | |
using IdentityModel.Client; | |
public class Startup | |
{ | |
/* removed all other code for brevity */ | |
public void ConfigureServices(IServiceCollection services) | |
{ |
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
/* | |
add those 2 services in Startup class of Identity Server 4 project. | |
services.AddTransient<ITokenService, TokenService>() | |
.AddTransient<ITokenCreationService, TokenCreationService>(); | |
*/ |
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
DECLARE @Data XML | |
SET @Data = '<Ids> | |
<Id>64122</Id> | |
<Id>12345</Id> | |
<Id>67890</Id> | |
</Ids>' | |
SELECT Ids.Id.value('text()[1]', 'varchar(100)') | |
FROM @Data.nodes('Ids/Id') AS Ids(Id) |
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
var rfv = document.getElementById('validator_control_id'); | |
ValidatorEnable(rfv, true); | |
ValidatorEnable(rfv, false); |
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; | |
using System.Linq.Expressions; | |
using System.Linq; | |
using System.Collections.Generic; | |
namespace Rvc.Utilities | |
{ | |
// refer to System.Web.Query.Dynamic namespace | |
public static class IQueryableExtensions | |
{ |
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 T.TABLE_NAME, C.COLUMN_NAME, C.DATA_TYPE, C.IS_NULLABLE | |
INTO #Tables | |
FROM INFORMATION_SCHEMA.TABLES T | |
INNER JOIN ( | |
SELECT TABLE_NAME, COLUMN_NAME, IS_NULLABLE, DATA_TYPE | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE COLUMN_NAME = TABLE_NAME + 'Id' | |
) C ON C.TABLE_NAME = T.TABLE_NAME | |
WHERE T.TABLE_TYPE = 'BASE TABLE' | |
AND T.TABLE_NAME NOT IN ( |
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 T.*, PK.COLUMN_NAME | |
INTO #Tables | |
FROM INFORMATION_SCHEMA.TABLES T | |
INNER JOIN ( | |
SELECT TABLE_NAME, COLUMN_NAME | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE COLUMNPROPERTY(OBJECT_ID(TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1 | |
) PK ON PK.TABLE_NAME = T.TABLE_NAME | |
WHERE T.TABLE_TYPE = 'BASE TABLE' | |
AND T.TABLE_NAME NOT IN ( |
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
ALTER PROCEDURE [dbo].[spGenerateEntity] | |
@TableName AS NVARCHAR(128), | |
@NewDateTypes AS BIT = 0 | |
AS | |
SELECT CASE WHEN COLUMN_NAME = TABLE_NAME + 'Id' THEN '[Column("' + COLUMN_NAME + '")] | |
public ' ELSE 'public ' END | |
+ CASE DATA_TYPE WHEN 'int' THEN 'int' | |
WHEN 'money' THEN 'decimal' | |
WHEN 'varchar' THEN 'string' | |
WHEN 'datetime' 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
$(function () { | |
var prm = Sys.WebForms.PageRequestManager.getInstance(); | |
if (prm != null) { | |
prm.add_endRequest(function (sender, e) { | |
/* | |
if (sender._postBackSettings.panelsToUpdate != null) { | |
DisplayCurrentTime(); | |
} | |
*/ | |
// invoke whatever functions |
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
ALTER FUNCTION [dbo].[fnGetCSharpTypeNameFromSQLTypeName] | |
( | |
@SQLTypeName NVARCHAR(64) | |
, @IsNullable BIT | |
) | |
RETURNS NVARCHAR(64) | |
AS | |
-- TEST: SELECT dbo.fnGetCSharpTypeNameFromSQLTypeName('MONEY', 1) | |
BEGIN | |
DECLARE @Result NVARCHAR(64) |