Skip to content

Instantly share code, notes, and snippets.

View mucit's full-sized avatar
🎯
Focusing

mucit mucit

🎯
Focusing
View GitHub Profile
@mucit
mucit / gist:976502
Created May 17, 2011 13:51
sql context_info data sharing across batchs
create proc dbo.setContextUser
@m varchar(15)
as
begin
declare @v varbinary(50) ; set @v = convert(varbinary(50), @m, 0)
SET CONTEXT_INFO @v
print @m + ' set edildi'
end
@mucit
mucit / EfPocoGenerator.sql
Created May 4, 2011 09:02 — forked from anehir/EfPocoGenerator.sql
Generates POCO classes for entity framework for all the tables in current database. Considers primary keys, foreign keys, and writes object descriptions saved as extended properties to the comments of classes.
set nocount on
declare @namespace varchar(500)
set @namespace = 'PersonnelManagement.Common.DataModel'
declare @typeMap table(sqlName varchar(50), dotNetName varchar(50), isNullable bit)
insert into @typeMap values('image', 'byte[2147483647]', null)
insert into @typeMap values('text', 'string', null)
insert into @typeMap values('uniqueidentifier', 'Guid', 0)
insert into @typeMap values('uniqueidentifier', 'Guid?', 1)
A common requirement with an XML file is to find a particular node. If you are targeting the .NET framework 3.5 or higher, you can find the node using Linq to XML or by using Lambda expressions.
As with many of my prior XML examples, the XML string is as follows:
<States>
<State name="Wisconsin">
<Regions>
<Region name="Milwaukee">
<Area name="Mukwanago"/>
<Area name="Germantown"/>
public class NeVar
{
//
}