Skip to content

Instantly share code, notes, and snippets.

View OliverRC's full-sized avatar
🤩
coding my heart out

Oliver Rivett-Carnac OliverRC

🤩
coding my heart out
View GitHub Profile
@OliverRC
OliverRC / code-first-migration
Created November 4, 2013 08:05
Code First Migration
Add-Migration {name}
@OliverRC
OliverRC / view-template.sql
Created October 25, 2013 11:24
View Template
IF EXISTS(SELECT * FROM sysobjects where id = object_id(N'<schema>.<view>') and OBJECTPROPERTY(id, N'IsView') = 1)
DROP VIEW <schema>.<view>
GO
CREATE VIEW dbo.vw_Mon_Casino
AS
GO
@OliverRC
OliverRC / stored-procedure-template.sql
Created October 25, 2013 11:23
Stored Procedure Template
IF EXISTS(SELECT * FROM sysobjects where id = object_id(N'<schema>.<procedureName>') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE <schema>.<procedureName>
GO
CREATE PROCEDURE <schema>.<procedureName> <@parameters
AS
BEGIN
END
@OliverRC
OliverRC / table-variable.sql
Created October 25, 2013 09:01
Table Variable
DECLARE @ProductTotals TABLE
(
ProductID int,
Revenue money
)
@OliverRC
OliverRC / chained-cte.sql
Created October 25, 2013 09:00
Chained CTE
;WITH cte_1 AS
(
),cte_2 AS
(
)
@OliverRC
OliverRC / cte.sql
Created October 25, 2013 09:00
Common Table Expression or CTE
;WITH cte_1 AS
(
)
@OliverRC
OliverRC / custom-errors.xml
Created October 8, 2013 13:27
Custom Errors Asp.NET
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
@OliverRC
OliverRC / no-wrap.css
Created October 8, 2013 11:29
No Wrap
white-space: nowrap;
@OliverRC
OliverRC / groupby-multiple
Created September 12, 2013 15:28
Group by multiple columns
group x by new { x.Column1, x.Column2 }
@OliverRC
OliverRC / basic-ef-query
Created August 23, 2013 09:08
Basic EF Query
using (var db = new ___DBContext())
{
var ___ = (from x in ___Includes(db.___)
where x.Id == id
select x).FirstOrDefault();
return ___;
}