Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
AutoMapper
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Fabio Miceli  
View profile   Translate to Translated (View Original)
 More options Feb 7, 7:27 am
From: Fabio Miceli <fbo.mcl...@gmail.com>
Date: Tue, 7 Feb 2012 04:27:18 -0800 (PST)
Local: Tues, Feb 7 2012 7:27 am
Subject: AutoMapper
ciao ragazzi,

sto sviluppando un' app in c# WPF utilizzando le Entity di EDM per
interfacciarmi con SQL Server

le classi DTO le inizializzo con AutoMapper, ho preso spunto da questo
articolo, http://samscode.com/index.php/2010/06/entity-framework-v4-end-to-end-...,
adattandolo al mio contesto.
Nel mio contesto ho tre tabelle di EDM associate tra loro,
rispettivamente Commessa>Dettaglio>SubDettaglio, Dettaglio e
SubDettaglio li mappo in modo esplicito, in questo modo,,,

.ForMember(dest => dest.dettaglio, opt => opt.MapFrom(obj =>
obj.DettaglioCommesse.IsLoaded ? obj.DettaglioCommesse : null))

 e fin qui,con AutoMapper, non ho nessun problema, sia da EDM a DTO
che l' inverso.

il problema nasce quando vado a mappare la tabella
SchedaProduzioneDTO, che è ObservableCollection di DipendentiDTO e di
SubDettaglioDTO, e rispettivamente in EDM SchedaProduzione è associata
a Dipendenti e a SubDettaglio. (1 di Dipendenti e molti di
SchedaProduzione, 1 di SubDettaglio e molti di SchedaProduzione),
che faccio in questo modo:

.ForMember(dest => dest.schedaProduzuone, opt => opt.MapFrom(src =>
src.SchedaProduzione.IsLoaded ? src.SchedaProduzione : null));

e mi genera questo errore:

{"Trying to map
System.Data.Objects.DataClasses.EntityCollection`1[[iGenius.SchedaProduzion e,
iGenius, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] to
System.Collections.ObjectModel.ObservableCollection`1[[iGenius.Dto.SchedaPr oduzioneDto,
iGenius, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].
\nUsing mapping configuration for iGenius.Dipendenti to
iGenius.Dto.DipendentiDto\nDestination property: schedaProduzuone
\nGenerata eccezione di tipo
'AutoMapper.AutoMapperMappingException'."}

credo che sia dovuto al fatto che SchedaProduzione è "figlio" di
Dipendenti e di SubDettaglio, poichè se "sgancio" SchedaProduzioneDTO
da SubDettaglioDTO, non ho nessun errore.

non riesco a trovare il modo corretto per mappare esplicitamente la
tabella SchedaProduzione,

qualcuno saprebbe darmi qualche suggerimento in merito ?

grazie anticipatamente


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »