Skip to content

Instantly share code, notes, and snippets.

@MayogaX
MayogaX / gist:4069174
Created November 13, 2012 23:36
Migration Automatic
Migration:AutomaticMigrationsEnabled = true;
@MayogaX
MayogaX / gist:4138205
Created November 24, 2012 03:03
Exemple List
private List<T> SetMyList (List<T> list)
{
MyClass my = new MyClass();
my.anything = “anything in string”;
my.theNumber = 666;
list.Add(my);
return my;
}
@MayogaX
MayogaX / gist:4138231
Created November 24, 2012 03:23
Exemple put data in list
List<MyClass> list = new List<MyClass>();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
MyClass class = new MyClass();
class.name = reader["name"].ToString();
class.number = Convert.Toint32(reader["number"]);
list.Add(class);
}
@MayogaX
MayogaX / gist:4214992
Created December 5, 2012 11:57
Install EF package
Install-Package EntityFramework
@MayogaX
MayogaX / gist:4338960
Created December 19, 2012 18:14
View do retorno do meu feed do meu blog
@model List<mayogaxdevblog.Models.Post>
@{
Layout = null;
}
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>MayogaX dev blog</title>
<link href="http://dev.mayogax.me/" />
<link href="http://feeds.feedburner.com/mayogaxdevblog/" rel="self" />
@foreach(mayogaxdevblog.Models.Post post in Model)
public class Manga
{
public int Id { get; set; }
public string Title { get; set; }
[Column(TypeName = "smallDateTime")]
public String Date { get; set; }
}
Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
@MayogaX
MayogaX / gist:5187236
Created March 18, 2013 13:46
para criação da tabela __MigrationsHistory
INSERT INTO [__MigrationHistory]
([MigrationId], [CreatedOn], [Model], [ProductVersion])
VALUES ('201202161546124_initial', '2012-02-16T15:55:56.252Z',
[big-ass hash you don’t need to see], '4.3.0')
//Inicialização do contexto:
private DataContex db = new DataContex("Data Source=C:\\Users\\priscila.sato\\Documents\\DBFile.sdf;");
//Método de construção na classe de contexto
public DataContex(string MangaString)
: base(MangaString)
{
}
@MayogaX
MayogaX / gist:5221572
Created March 22, 2013 14:14
exemplo de web.config para habilitar Url Rewrite com PHP no IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<sectionGroup name="system.webServer">
<sectionGroup name="rewrite">
<section name="rewriteMaps" overrideModeDefault="Allow" />
<section name="rules" overrideModeDefault="Allow" />
</sectionGroup>
</sectionGroup>
</configSections>