How to map EF model property to XSD element?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri I have to create hundreds of XML files at run time, for each of the XML file there is one XSD schema. We use .Net entity framework to get the data from the database.
<span style="font-size:small <span style="font-family:Calibri Is there anyway at design time i can define "XSD element to DataBase Table Column" mapping in XSD itself. So that at runtime when i actually create XML, the framework can auto
populate the XML with actual data? If Yes how do i do that, any article would be fine. If not then any suggestion developing custom approch.

<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri For example following is sample XSD. How do I define from where the actual FirstName value is coming from.

<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri An artical on how to use it will be appriciated
<span style="font-size:small <span style="font-family:Calibri
<div style="background-color:white; color:black
<pre><span style="color:blue <?<span style="color:#a31515 xml <span style="color:red version<span style="color:blue =<span style="color:black "<span style="color:blue 1.0<span style="color:black " <span style="color:red encoding<span style="color:blue =<span style="color:black "<span style="color:blue utf-8<span style="color:black "<span style="color:blue ?>

<span style="color:blue <<span style="color:#a31515 xs<span style="color:blue :<span style="color:#a31515 schema <span style="color:red attributeFormDefault<span style="color:blue =<span style="color:black "<span style="color:blue unqualified<span style="color:black " <span style="color:red elementFormDefault<span style="color:blue =<span style="color:black "<span style="color:blue qualified<span style="color:black " <span style="color:red xmlns:xs<span style="color:blue =<span style="color:black "<span style="color:blue http://www.w3.org/2001/XMLSchema<span style="color:black "<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 xs<span style="color:blue :<span style="color:#a31515 element <span style="color:red name<span style="color:blue =<span style="color:black "<span style="color:blue Person<span style="color:black "<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 xs<span style="color:blue :<span style="color:#a31515 complexType<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 xs<span style="color:blue :<span style="color:#a31515 sequence<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 xs<span style="color:blue :<span style="color:#a31515 element <span style="color:red name<span style="color:blue =<span style="color:black "<span style="color:blue FirstName<span style="color:black " <span style="color:red type<span style="color:blue =<span style="color:black "<span style="color:blue xs:string<span style="color:black " <span style="color:blue />


<span style="color:blue </<span style="color:#a31515 xs<span style="color:blue :<span style="color:#a31515 sequence<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 xs<span style="color:blue :<span style="color:#a31515 complexType<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 xs<span style="color:blue :<span style="color:#a31515 element<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 xs<span style="color:blue :<span style="color:#a31515 schema<span style="color:blue >

[/code]




View the full article
 
Back
Top