Skip to content

Instantly share code, notes, and snippets.

View JoshClose's full-sized avatar

Josh Close JoshClose

View GitHub Profile
@JoshClose
JoshClose / Example2.cs
Created November 15, 2011 00:57
Navigation with MVVM on WP7
using System.Windows.Navigation;
using Microsoft.Practices.Prism.ViewModel;
namespace RememberIt.WP7.App.ViewModels
{
public abstract class ViewModelBase : NotificationObject
{
protected bool RemoveBackEntry { get; set; }
public NavigationService NavigationService { get; set; }
@JoshClose
JoshClose / Audit.sql
Created November 15, 2011 04:02
Audit Trail with NHibernate Using a Custom log4net Appender
CREATE TABLE [dbo].[Audit]
(
[Id] INT NOT NULL IDENTITY,
[User] NVARCHAR( 100 ) NOT NULL,
[Trail] NVARCHAR( MAX ) NOT NULL,
[Created] DATETIME NOT NULL
)
ALTER TABLE [dbo].[Audit]
ADD CONSTRAINT [PK_Audit_Id]
@JoshClose
JoshClose / File1.cs
Created November 15, 2011 04:44
Getting Arguments from a Running Process
var processes = Process.GetProcessesByName( "MyProcess" );
@JoshClose
JoshClose / IBlogService.cs
Created November 15, 2011 04:58
Setting Up WCF with Multiple Services and Multiple Databases Using NHibernate and Ninject
using System.Collections.Generic;
using System.ServiceModel;
using Wnn.Service.Contract.DataContracts;
namespace Wnn.Service.Contract.ServiceContracts
{
[ServiceContract]
public interface IBlogService
{
[OperationContract]
@JoshClose
JoshClose / BlogService.cs
Created November 15, 2011 05:10
Setting Up WCF with Multiple Services and Multiple Databases Using NHibernate and Ninject 2
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using Wnn.Business.Repositories;
using Wnn.Service.Contract.DataContracts;
using Wnn.Service.Contract.ServiceContracts;
namespace Wnn.Service
{
[ServiceBehavior( InstanceContextMode = InstanceContextMode.PerCall )]
@JoshClose
JoshClose / NHibernateBehaviorExtensionElement.cs
Created November 15, 2011 05:20
Setting Up WCF with Multiple Services and Multiple Databases Using NHibernate and Ninject 3
using System;
using System.ServiceModel.Configuration;
namespace Wnn.Service.Host
{
public class NHibernateBehaviorExtensionElement : BehaviorExtensionElement
{
protected override object CreateBehavior()
{
return new NHibernateServiceBehavior();
@JoshClose
JoshClose / ScreenShot.cs
Created November 15, 2011 05:38
Programmatically Taking a Full Web Page Screenshot
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class ScreenShot
{
[ComImport]
[InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
[Guid( "0000010d-0000-0000-C000-000000000046" )]
@JoshClose
JoshClose / File1.xml
Created November 15, 2011 05:42
Dynamically Loading Partial Views with the Spark View Engine
<use file="MyPartialView" />
@JoshClose
JoshClose / File1.cs
Created November 15, 2011 15:02
ASP.NET MVC, Ninject.Web.Mvc and 404’s
protected void Application_Error( object sender, EventArgs e )
{
var exception = Server.GetLastError();
Response.Clear();
var httpException = exception as HttpException;
var routeData = new RouteData();
routeData.Values.Add( "controller", "Error" );
@JoshClose
JoshClose / File1.cs
Created November 15, 2011 15:05
NHibernate 2.1 and Unit Testing with MSTest Using MSBuild
[DeploymentItem( @"..\References\NHibernate\NHibernate.ByteCode.LinFu.dll" )]