Skip to content

Instantly share code, notes, and snippets.

View mgroves's full-sized avatar

Matthew D. Groves mgroves

View GitHub Profile
[Migration(2)]
public class AddUrlToUserTable : Migration
{
public override void Up()
{
Alter.Table("myusertable")
.AddColumn("url").AsString(150).Nullable();
}
public override void Down()
[Migration(1)]
public class CreateUserTable : Migration
{
public override void Up()
{
Create.Table("myusertable")
.WithColumn("id").AsInt32().NotNullable().PrimaryKey().Identity()
.WithColumn("name").AsString(100).NotNullable()
.WithColumn("birthdate").AsDateTime().NotNullable()
.WithColumn("address").AsString(100).NotNullable()
public override void OnInvoke(MethodInterceptionArgs args)
{
try
{
args.Proceed();
}
catch (SqlException ex)
{
ex.ToExceptionless().Submit();
var obj = (ServiceBase) args.Instance;
public override void OnInvoke(MethodInterceptionArgs args)
{
try
{
args.Proceed();
}
catch (SqlException ex)
{
ex.ToExceptionless().Submit();
var obj = (ServiceBase) args.Instance;
public override void OnInvoke(MethodInterceptionArgs args)
{
try
{
args.Proceed();
}
catch (Exception ex)
{
ex.ToExceptionless().Submit();
var obj = (ServiceBase)args.Instance;
public override bool CompileTimeValidate(MethodBase method)
{
if (!typeof (ServiceBase).IsAssignableFrom(method.DeclaringType))
{
Message.Write(method, SeverityType.Error, "SEI01", "The target type (" + method.DeclaringType.FullName + ") does not implement ServiceBase.");
return false;
}
return base.CompileTimeValidate(method);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Matthew D. Groves</title>
<link href="Content/style.css" rel="stylesheet">
</head>
public override void OnInvoke(MethodInterceptionArgs args)
{
try
{
args.Proceed();
}
catch (SqlException ex)
{
var service = args.Instance as ServiceBase;
if(service != null)
public abstract class ServiceBase
{
public Action<string> AddValidationError { get; set; }
}
public class TerritoryService : ServiceBase, ITerritoryService
{
public int DoSomething(int id)
{
// do something
public override void OnInvoke(MethodInterceptionArgs args)
{
try
{
args.Proceed();
}
catch (SqlException ex)
{
var terrService = args.Instance as ITerritoryService;
if(terrService != null)