Click here to Skip to main content
15,890,882 members
Home / Discussions / C#
   

C#

 
AnswerRe: Pending Status for new Articles Pin
manchanx23-Feb-15 17:38
professionalmanchanx23-Feb-15 17:38 
GeneralRe: Pending Status for new Articles Pin
Evil Iceblock23-Feb-15 18:02
Evil Iceblock23-Feb-15 18:02 
QuestionCryptography Pin
Afraz Nazeer Janjua22-Feb-15 7:40
Afraz Nazeer Janjua22-Feb-15 7:40 
AnswerRe: Cryptography Pin
Pete O'Hanlon22-Feb-15 7:47
mvePete O'Hanlon22-Feb-15 7:47 
AnswerRe: Cryptography Pin
Dave Kreskowiak22-Feb-15 9:20
mveDave Kreskowiak22-Feb-15 9:20 
AnswerRe: Cryptography Pin
OriginalGriff22-Feb-15 20:42
mveOriginalGriff22-Feb-15 20:42 
AnswerRe: Cryptography Pin
Afzaal Ahmad Zeeshan23-Feb-15 9:06
professionalAfzaal Ahmad Zeeshan23-Feb-15 9:06 
QuestionAutomapping properties assistance required Pin
Eagle3222-Feb-15 3:50
Eagle3222-Feb-15 3:50 
I am currently working with a DB table and I need to map extra properties from DAO to BE class.

I have to produce XML like the following:

XML
 <Zoos>
 <Zoo>
   <ZooId>234OI456<ZooId>
   <Name>The Zoo</Name>
   <Address>3456 Kramer</Address
   <ZipCode>92345-8922</ZipCode>
   <Animals>
     <Animal Type="REPTILE">Cobra</Animal>
   <Animals>
  <Zoo>
<Zoos>


The extra columns in the db view are like so:

ANI_TYPE VARCHAR(20)
ANI_VALUE VARCHAR(20)

Previously when I didn't have the extra columns I mapped the values like this for each Zoo

C#
  Mapper.CreateMap<ZooDAO, ZooBE>()
.ForMember(d => d.ZooId, e => e.ZOO_ID))
.ForMember(d => d.Name, e => e.ZOO_NAME))
.ForMember(d => d.Address, e => e.ZOO_ADDRESS))
.ForMember(d => d.ZipCode, e => e.ZOO_ZIPCODE));


How would I go about mapping these 2 columns(ANI_TYPE, ANI_VALUE) so i can create the structure shown in the xml in regards to Animals?

I have a c# class for Animal type which has the following

C#
public enum AnimalType
{
  INVALID,
  REPTILE,
  MAMMAL,
  INSECT
}


My C# class for the Animal looks like this but i guess it will require rework. Feel free to provide suggestions/examples:

Currently this is what my classes look like:

C#
//BE class
public class Zoo
{
  public int ZooId {get; set;}
  public string Name { get; set; }
  public string Address {get; set; }
  public string ZipCode {get; set;}
  public List<Animal> Animals {get; set;} 
}


This is my current setup for Animal entity
C#
//BE Class
public class Animal
{
  public string Type {get; set;}
  public string Text { get; set; }
}


I appreciate if someone can assist me with the above.

Thanks,
AnswerRe: Automapping properties assistance required Pin
manchanx22-Feb-15 5:27
professionalmanchanx22-Feb-15 5:27 
GeneralRe: Automapping properties assistance required Pin
Eagle3222-Feb-15 22:10
Eagle3222-Feb-15 22:10 
GeneralRe: Automapping properties assistance required Pin
manchanx22-Feb-15 22:41
professionalmanchanx22-Feb-15 22:41 
QuestionMessage Closed Pin
21-Feb-15 2:01
Member 1138819921-Feb-15 2:01 
AnswerRe: Keeping an Application Intact even after Format Pin
BillWoodruff21-Feb-15 2:09
professionalBillWoodruff21-Feb-15 2:09 
GeneralRe: Keeping an Application Intact even after Format Pin
OriginalGriff21-Feb-15 2:30
mveOriginalGriff21-Feb-15 2:30 
GeneralRe: Keeping an Application Intact even after Format Pin
manchanx21-Feb-15 11:24
professionalmanchanx21-Feb-15 11:24 
GeneralRe: Keeping an Application Intact even after Format Pin
Richard MacCutchan21-Feb-15 21:29
mveRichard MacCutchan21-Feb-15 21:29 
GeneralRe: Keeping an Application Intact even after Format Pin
manchanx21-Feb-15 21:57
professionalmanchanx21-Feb-15 21:57 
GeneralRe: Keeping an Application Intact even after Format Pin
Nelek24-Feb-15 13:12
protectorNelek24-Feb-15 13:12 
QuestionMessage Removed Pin
20-Feb-15 15:22
professionalDaniel Lieberwirth (BrainInBlack)20-Feb-15 15:22 
SuggestionMessage Removed Pin
20-Feb-15 21:56
mveRichard MacCutchan20-Feb-15 21:56 
GeneralMessage Removed Pin
20-Feb-15 22:09
professionalDaniel Lieberwirth (BrainInBlack)20-Feb-15 22:09 
GeneralMessage Removed Pin
20-Feb-15 22:50
mveRichard MacCutchan20-Feb-15 22:50 
AnswerMessage Removed Pin
20-Feb-15 22:16
mvePete O'Hanlon20-Feb-15 22:16 
GeneralMessage Removed Pin
20-Feb-15 22:31
professionalDaniel Lieberwirth (BrainInBlack)20-Feb-15 22:31 
GeneralMessage Removed Pin
20-Feb-15 22:53
mvePete O'Hanlon20-Feb-15 22:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.