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
/// <summary> | |
/// Converting the string value to T type | |
/// </summary> | |
/// <typeparam name="T">Type to convert string value to</typeparam> | |
/// <param name="value">String value to be converted to type T</param> | |
/// <returns>Returns converted string value to type T</returns> | |
public static T ConvertTo<T>(this string value) where T : IConvertible | |
{ | |
var typeCode = default(T).GetTypeCode(); | |
switch (typeCode) |
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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Data; | |
using System.Data.SqlClient; | |
using log4net; | |
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(var img = Image.FromFile(file.Name)) | |
{ | |
var height = img.Height; | |
var width = img.Width; | |
} |
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 ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='spDateNow' |
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 * FROM myTable WHERE myField = 'sOmeVal' COLLATE SQL_Latin1_General_CP1_CI_AS |
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
/// <summary> | |
/// Compares elements of two IEnumerables of same type regardless of element order in both Ienumrables | |
/// </summary> | |
/// <typeparam name="T">Type of IEnumerables to compare</typeparam> | |
/// <param name="Compare">IEnumareble to compare with</param> | |
/// <param name="CompareTo">IEnumerable to compare to</param> | |
/// <returns></returns> | |
public static bool Equals<T>(this IEnumerable<T> Compare, IEnumerable<T> CompareTo) | |
{ | |
return new HashSet<T>(Compare ?? new List<T>()).SetEquals(CompareTo ?? new List<T>()); |
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 * FROM information_schema.parameters | |
WHERE specific_name='<stored_procedure_name>' |
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
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
CREATE PROCEDURE MigrateStoredProcedure | |
@ProcedureName VARCHAR(50), | |
@TargetDatabase VARCHAR(50) | |
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
public static Type GetClrType(SqlDbType sqlType) | |
{ | |
switch (sqlType) | |
{ | |
case SqlDbType.BigInt: | |
return typeof(long?); | |
case SqlDbType.Binary: | |
case SqlDbType.Image: | |
case SqlDbType.Timestamp: |
OlderNewer