SQL Server nHibernate Config

/// <summary>
/// Get Factory
/// </summary>
/// <returns></returns>
private ISessionFactory CreateSessionFactory()
{
       return Fluently.Configure()
        .Database(MsSqlConfiguration.MsSql2012.ConnectionString(
             c => c.FromConnectionStringWithKey("ConnectionString")))
        .Mappings(m => m.FluentMappings.AddFromAssemblyOf<StockSymbols>())
        .Mappings(m => m.FluentMappings.AddFromAssemblyOf<StockQuotes>())
        .BuildSessionFactory();    
}        

Download SQL Server Northwind Database .BAK File

Download the SQL Server Northwind Database backup from from Codeplex or by clicking the link below.

Download NORTHWIND.Bak.Zip

SQL Server Functions - Get First and Last Day in a Month

CREATE FUNCTION [dbo].[f_get_first_date_of_month] 
(
    @Date DATETIME
)
RETURNS DATETIME
AS
BEGIN

   return DATEADD(d, 0, DATEADD(m, DATEDIFF(m, 0, @Date), 0))
END
CREATE FUNCTION [dbo].[f_get_last_date_of_month] 
(
    @Date DATETIME
)
RETURNS DATETIME
AS
BEGIN

    RETURN DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, @Date) + 1, 0))

END