Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion MDFe.Classes/Informacoes/Evento/MDFeInfEvento.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ namespace MDFe.Classes.Informacoes.Evento
public class MDFeInfEvento
{
[XmlIgnore]
private readonly VersaoServico _versaoServico = MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout;
private readonly VersaoServico _versaoServico;

public MDFeInfEvento() : this(null) { }

public MDFeInfEvento(MDFeConfiguracao cfgMdfe)
{
var config = cfgMdfe ?? MDFeConfiguracao.Instancia;
_versaoServico = config.VersaoWebService.VersaoLayout;
}

[XmlAttribute(AttributeName = "Id")]
public string Id { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion MDFe.Servicos/EventosMDFe/FactoryEvento.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static MDFeEventoMDFe CriaEvento(MDFeEletronico MDFe, MDFeTipoEvento tipo
var eventoMDFe = new MDFeEventoMDFe
{
Versao = config.VersaoWebService.VersaoLayout,
InfEvento = new MDFeInfEvento
InfEvento = new MDFeInfEvento(config)
{
Id = "ID" + (long)tipoEvento + MDFe.Chave() + sequenciaEvento.ToString("D2"),
TpAmb = config.VersaoWebService.TipoAmbiente,
Expand Down