0
I am on a project where it is necessary to exchange the ORM from Nhibernate to Entityframeworkcore. With this, all the mappings will have to be rewritten to the Entity standard and I’m having some difficulties in redoing the classes. Do I get anything on the Web that addresses that transcript? Ex: the class below is written in Fluentnhibernate:
public AgendaGrupoMap()
{
Table("AGENDA_GRUPO");
Id(x => x.Id).Column("id_agenda_grupo");
Map(x => x.IdMedico, "id_medico");
Map(x => x.IdUnidade, "id_unidade");
Map(x => x.VigenciaInicio, "dt_vigencia_inicio");
Map(x => x.VigenciaTermino, "dt_vigencia_termino");
Map(x => x.Ativo, "fl_ativo");
HasMany<Agenda>(x => x.Agendas)
.KeyColumn("id_agenda_grupo")
.Cascade.None()
.Not.KeyUpdate();
References(x => x.Medico)
.Class<Medico>()
.Columns("id_medico")
.Not.Update()
.Not.Insert();
}
and the rewriting for Entity
is as follows:
public void Configure(EntityTypeBuilder<AgendaGrupo> builder)
{
builder.HasKey(x => x.Id);
builder.Property(x => x.Id)
.HasColumnName("id_agenda_grupo");
builder.Property(x => x.IdMedico)
.HasColumnName("id_medico");
builder.Property(x => x.IdUnidade)
.HasColumnName("id_unidade");
builder.Property(x => x.VigenciaInicio)
.HasColumnName("dt_vigencia_inicio");
builder.Property(x => x.VigenciaTermino)
.HasColumnName("dt_vigencia_termino");
builder.Property(x => x.Ativo)
.HasColumnName("fl_ativo");
builder.HasMany(x => x.Agendas).WithOne(x => x.AgendaGrupo);
builder.ToTable("AGENDA_GRUPO");
In this rewrite I don’t know how to rewrite this excerpt (References
) to the Entity
:
References(x => x.Medico)
.Class<Medico>()
.Columns("id_medico")
.Not.Update()
.Not.Insert();
Can you suggest something to me? Thank you...
And then you clarified the answer Something helped you?
– novic