Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Management;
namespace ConsoleDemo
{
class Printer
{
public enum TechnologyType
{
Other = 1,
The following Method Catch details of SqlException which can be logged or displayed to user
public StringBuilder SqlExceptionMessage(SqlException ex)
{
StringBuilder sqlErrorMessages = new StringBuilder("Sql Exception:\n");
foreach (SqlError error in ex.Errors)
{
sqlErrorMessages.AppendFormat("Mesage: {0}\n", error.Message)
.AppendFormat("Severity level: {0}\n", error.Class)
//Lab demo using smo
//Server sql server 2012
//client has smo installed for sql 2016
using System;
using System.Data;
using ConsoleApplication1;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Trace;
The generated schema with external reference manually using NJsonSchema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "personal",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
/*
In Xunit, NUnit or Test projects, inherit this class to avoid null exception
due to null assembly attributes when using CommandLineParser library
*/
public class BaseTest
{
public BaseTest()
{
//in Full Framework NET4x only, because no appdomain in netcore
@moh-hassan
moh-hassan / defineconst.csproj
Created April 8, 2019 18:11
define constant in msbuild project: NETFRAMEWORK, NETSTANDARD and NETCORE
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
<DefineConstants>$(DefineConstants);NETFRAMEWORK</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('netcoreapp'))">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
</PropertyGroup>
#version is nly changed by RELEASE TAG
version: 2.5.2-dev.{build}
image:
#- Visual Studio 2017
- Ubuntu
#shallow_clone: true
pull_requests:
version: 2.6.0-dev.{build}
image:
# Visual Studio 2017
- Ubuntu
init:
- sudo apt-get install -y nuget mono-complete
- mono -V
# mono --gc=sgen ~/src/code/Tools/MSBuild/Developer/bin/xunit.console.exe