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
/********************************** | |
* Title: DataGridViewColumn Hosting MaskedTextBox | |
* Author: Juergen Thomas, Berlin (Germany) | |
* Email: post@vs-polis.de | |
* Environment: WinXP, NET 2.0 | |
* Keywords: DataGridViewColumn, | |
* DataGridViewMaskedTextColumn, | |
* DataGridViewMaskedTextCell, | |
* DataGridViewMaskedTextControl, | |
* DataGridViewTextBoxColumn, |
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
/// <summary> | |
/// Firebird possui limitação de 31 caracteres em nomes de tabelas, constraints, etc. | |
/// Esta convenção limita o nome do AssociationSet para 28 caracteres pois o Script SQL gerado para criação utiliza o AssociationSet.Name para | |
/// formar a constraint de chave estrangeira FK_{0}, associationSet.Name | |
/// </summary> | |
public class AssociationSetNamingConvention : IStoreModelConvention<AssociationSet> | |
{ | |
public void Apply(AssociationSet item, DbModel model) | |
{ | |
if (item.Name.Length <= 28) |
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
public class Dto | |
{ | |
public int Formato1 { get; set; } | |
public int Formato2 { get; set; } | |
public Embalagem Embalagem { get; set; } | |
public string Produto { get; set; } | |
public decimal QtdeTotal { get; set; } | |
public static IEnumerable<Dto> Teste(ArmazemCtx context) | |
{ |
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
using System; | |
using System.Linq; | |
namespace Metavision.Infra.Data | |
{ | |
public interface IUnitOfWork : IDisposable | |
{ | |
T Find<T>(params object[] keyValues) where T : class , new(); | |
/// <summary> |
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
using System; | |
using System.Collections.Generic; | |
namespace Metavision.Infra.Data | |
{ | |
public interface IRepositorio : IDisposable | |
{ | |
bool HasChanges { get; set; } | |
IUnitOfWork UnitOfWork { get; } | |
} |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Metavision.Infra.Data; | |
namespace Metavision.Infra.Extensions | |
{ | |
public static class DataExtensions | |
{ | |
#region extensoes para Repositório |
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
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
namespace Metavision.Infra.Data | |
{ | |
public abstract class UnitOfWorkBase : IDisposable | |
{ | |
protected readonly Stack<IRepositorio> StackRepositories | |
= new Stack<IRepositorio>(); |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
namespace Metavision.Infra | |
{ | |
/// <summary> | |
/// Service Locator simples | |
/// </summary> |
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
using System; | |
using System.Data; | |
using System.Data.Entity; | |
using System.Data.Entity.Infrastructure; | |
using System.Data.Objects; | |
using System.Linq; | |
namespace Metavision.Infra.Data | |
{ | |
/// <summary> |
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
public void DemonstrarEntityFramework() | |
{ | |
var dbContext = new MyEntities(); //instancia um dbContext | |
var uow = new CodeFirstUnitOfWork(dbContext); //instancia um unit_of_work para coordenar repositórios | |
var repositorioPessoas = new Repositorio<Pessoa>(uow); //cria um novo repositório passando o unitOfWork | |
var repositorioEnderecos = new Repositorio<Endereco>(uow);//cria um novo repositório passando o unitOfWork | |
var novaPessoa = repositorioPessoas.CreateNew(); //fabrica uma nova entidade | |
novaPessoa.Nome = "Jone Polvora"; //seta o valor do campo Nome |