Ícones sprite com o css prontinho, só chegar e usar!
https://github.com/eduardosilva/icons-silk-sprite
https://github.com/eduardosilva/icons-fugue-sprite
https://github.com/eduardosilva/icons-farm-fresh-sprite
sexta-feira, 24 de janeiro de 2014
terça-feira, 14 de janeiro de 2014
Carregando dinamicamente as configurações do Entity Framework Code First
Abaixo um exemplo de como carregar as configurações customizadas de mapeamentos para o Entity Framework Code First.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnModelCreating(DbModelBuilder modelBuilder) | |
{ | |
//MyDataContext: is my current database context | |
var configurationTypes = typeof(DataContext).Assembly.GetTypes() | |
.Where(t => t.IsAbstract == false && | |
t.BaseType != null && | |
t.BaseType.IsGenericType && | |
(t.BaseType.GetGenericTypeDefinition() == typeof(EntityTypeConfiguration<>) || | |
t.BaseType.GetGenericTypeDefinition() == typeof(ComplexTypeConfiguration<>))) | |
.ToArray(); | |
foreach (var configurationType in configurationTypes) | |
{ | |
dynamic configurationTypeInstance = Activator.CreateInstance(configurationType); | |
modelBuilder.Configurations.Add(configurationTypeInstance); | |
} | |
base.OnModelCreating(modelBuilder); | |
Database.SetInitializer<DataContext>(null); | |
} |
Assinar:
Postagens (Atom)