Method returning object name in Entity

Asked

Viewed 51 times

0

I have the following method:

internal ArquivoVersao GetArquivoVersao(string arquivoVersaoGuid)
    {
        using (var ctx = new TestEntities())
        {
            var versao = (from ver in ctx.ARQUIVO_VERSAO
                          where ver.ARQUIVO_VERSAO_GUID == arquivoVersaoGuid
                          select new ArquivoVersao()
                          {
                              ARQUIVO_GUID = ver.ARQUIVO_GUID,
                              ARQUIVO = ver.ARQUIVO,
                              USUARIO_PESSOA_GUID = ver.USUARIO_PESSOA_GUID,
                              TAMANHO = ver.TAMANHO,
                              DATAHORA = ver.DATAHORA,
                              ARQUIVO_VERSAO_GUID = ver.ARQUIVO_VERSAO_GUID
                          }).FirstOrDefault();
            return versao;
        }
    }

i want to show the result, when calling this method it shows the object, wanted to show a value on the screen. I sent a . Tostring() but it won’t.

  • How you try to display this value on the screen?

  • Response.write("Value:"+dal.GetArchvoVersao.Tostring());

  • or store the method in a string, whatever

  • You are trying to give a . Tostring() in Object... tries to do so Archival.GetArchitectVersao.FILE.Tostring()

  • this way he returned me his type, System.Byte[]

  • Which field do you want to display? just put it in the place of file, for example. Arquivodal.GetAquivoVersao.DATAHORA.Tostring()

  • It worked, thanks, if you want to create answer, I do a joinha. Thanks

Show 2 more comments

1 answer

0


You are trying to give a . Tostring() in Object.

Try to do it this way

ARQUIVOdal.GetArquivoVersao.NOME_DA_PROPRIEDADE_QUE_QUER_EXIBIR.ToString();
  • It worked, thank you

  • If I have a method q returns an Entity list, how would it look? appears in the method.Tolist, but did not know how to show

  • I believe you will have to do a FOREACH(object in list)

  • All right, thanks...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.