LINQ to XML, ORM or something "completely different"?

I am working on a Silverlight Project with all the features and limitations that entail. This is an update for the previous product. The goal of quickly entering the market is to maintain as many internal ones as possible (web services, databases, etc.). Our mandate is to touch only the inside, if there is no other way. First of all, we will focus on rewriting the external interface. An important industry conference will soon be held, where we will want to demonstrate an early appearance of the product. It may be time before the official release to do some processing, but to support the back-end, you will need to wait until version V2.

OK, so I'm trying to use the MVVM template with data binding to the interface for which I am responsible (the MVVM template is dictated from above). I have a pre-existig web service that serves some XML. An example of this XML is as follows:

<CODEBOOKINDEX>
    <ME Words="1" Score="25" Highscore="1">Main Entry Item
        <NM>attack</NM>
        <NM>cardiac</NM>
        <NM>chest</NM>
        <NM>effort</NM>
        <NM>heart</NM>
        <NM>pectoris</NM>
        <NM>syndrome</NM>
        <NM>vasomotor</NM>
        <IE>413.9</IE>

        <M1 Words="1" Score="25">An M1 Item (Same as ME, just first level Child)
            <IE>557.1</IE>
        </M1>

        <M1 Words="1" Score="25">Another M1 Item
        <IE>443.9</IE>
            <M2 Words="1" Score="25">An M2 Item (again same as ME, just a child of an M1 item)
                <CF>Arteriosclerosis,extremities</CF>
                <IE>440.20</IE>
            </M2>
        </M1>
    </ME></CODEBOOKINDEX>

, , MVVM, , . , "Entry", MainEntry (ME) Subentries (M1 M2 ), ( IE node, ), 0 node (, NM CF node ). ( , ), XML, :

  • MVVM ( , , , ).
  • XML node, .
  • (, NM) , , .

, , XML bindable, , , XML , .

LINQ to XML, ORM, , NHibernate Entity Framework ( WHICH ORM, )?
, , . .

, :

  • ORM? , XAP ( ), .
  • , EF NHibernatge , ? , SOMETHING, - , , .
  • , , , (.. -) ?
+3
1

ORM?

. , - .


Linq to Xml.

public CustomClass TranslateME(XElement source)
{
  CustomClass result = new CustomClass();
  result.Words = (int) source.Attribute("Words");
  result.Score = (int) source.Attribute("Score");

  XAttribute highScore = source.Attribute("HighScore");
  result.HighScore = (highScore == null) ? 0 : (int) highScore;

  result.NMs = source
    .Elements("NM")
    .Select(x => x.Value)
    .ToList();

  result.IE = source
    .Element("IE").Value;

  result.SubEntries = source
    .Elements("M1")
    .Select(x => TranslateM1(x))
    .ToList();

  return result;
}
+8

All Articles