Skip to content

Instantly share code, notes, and snippets.

@adilsoncarvalho
Created September 5, 2014 13:57
Show Gist options
  • Save adilsoncarvalho/2882336171a8b131ce8c to your computer and use it in GitHub Desktop.
Save adilsoncarvalho/2882336171a8b131ce8c to your computer and use it in GitHub Desktop.
Conversa com o Léo e o Otaviano
// BASE
- Addict ... add<IParceiro>() : where new()
public T FindBy<T>(int id) where T : IParceiro {
var p = Addict.Create<T>() { .... props .... }
return p
}
public bool Save<T>(params T parceiros) where T : IParceiro {
parceiros.ToList().ForEach(Save); &:save
parceiros.ToList().ForEach(p => { Save(p); }); &:save
}
internal bool Save(IParceiro parceiro)
------ assembly pit -------
// DECORLUX
LibBase.GerenciadorDeps.Add<IParceiro>(() => new ParceiroDecorlux() )
class ParceiroDecorlux : IParceiro {
prop :codigo
prop Conexao { get { GD.new<IConexao>(); } }
}
{
var parceiro = FindBy(100); // IParceiro
var parceiro = FindBy<ParceiroDecorlux>(100);
Save(parceiro);
Save(parceiro1, parceiro2);
Save(new List<IParceiro> { ...., ..., ... })
Save(new[] {...., ..., ...})
}
new GD() ....
new ParceiroDecorlux(GD()) {
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment