How to pass a string value to a type in Entity

1

In my entity mapping, the fields that are FK look like this:

public virtual T_Acao T_Acao { get; set; }
public virtual ICollection<T_OsParceiro> T_OsParceiro { get; set; }
public virtual T_ProximaAcao T_ProximaAcao { get; set; }

In my program, I need to pass a string value to T_Action. How do I do this? I tried a cast like that, but I could not:

tarefa.T_Acao = osParceiro.AcaoParceiro;

AcaoParceiro is of type string . I tried casting this way:

tarefa.T_Acao = (SuporteTecnico.Models.T_Acao)osParceiro.AcaoParceiro;

The error is:

  

Can not implicit convert type "string" to    SuporteTecnico.Models.T_Acao

    
asked by anonymous 02.06.2014 / 21:23

1 answer

2

I killed a colleague's juda. I did so:

T_Acao t = new T_Acao();
t.acao = osParceiro.Acao;
tarefa.T_Acao = t;
    
02.06.2014 / 21:54