keyongtech


  keyongtech > dotnet.languages.* > dotnet.languages.csharp

 #1  
03-03-08, 03:53 PM
parez
Hi All

I am trying to generate classes from XSD which looks like this

namespace WindowsFormsApplication1.Something.Some
{
public class Address
{

public Address()
{
}


[FormMapper("TextBox2")]

public string StreetAddress { get; set; }
[FormMapper("TextBox3")]
public string UnitNumber { get; set; }
[FormMapper("TextBox4")]
public string City { get; set; }
[FormMapper("TextBox5")]
public string State { get; set; }
[FormMapper("TextBox6")]
public string zip { get; set; }

}
}




How do i represent the FormMapper Attribute in the xsd.

Please Help and thanks
 #2  
03-03-08, 06:29 PM
parez
On Mar 3, 11:53 am, parez <psaw> wrote:
[..]
> [FormMapper("TextBox6")]
> public string zip { get; set; }
>
> }
>
> }
>
> How do i represent the FormMapper Attribute in the xsd.
>
> Please Help and thanks


Where are the C# Jedis?
 #3  
03-03-08, 06:36 PM
Jon Skeet [C# MVP]
parez <psawant> wrote:

<snip>

> Where are the C# Jedis?


Perhaps if you gave more information in your question - like how your
code currently works - you'd be more likely to get an answer.
 #4  
03-03-08, 07:03 PM
parez
On Mar 3, 2:36 pm, Jon Skeet [C# MVP] <sk> wrote:
> parez <psaw> wrote:
>
> <snip>
>
> > Where are the C# Jedis?

>
> Perhaps if you gave more information in your question - like how your
> code currently works - you'd be more likely to get an answer.
>
> --
> Jon Skeet - <sk>[..] Blog:[..]
> World class .NET training in the UK:[..]


I dont have currently working code. I have been recommended to use
XSD.exe to generate the code instead of typing it in.


The auto generated code should have custom attributes (in my example
it its FormMapper)


public class Address
{

public Address()
{
}


[FormMapper("TextBox2")]

public string StreetAddress { get; set; }
[FormMapper("TextBox3")]
public string UnitNumber { get; set; }
[FormMapper("TextBox4")]
public string City { get; set; }
[FormMapper("TextBox5")]
public string State { get; set; }
[FormMapper("TextBox6")]
public string zip { get; set; }

}








What I am trying to do is.
I have to send XML requests to the server based on the events on my
winform applications. They could add/update/get requests. I will have
70-80 different requests types and hence 70-80 XSDs (or Classes) to
maintain.
I am planning to use reflection to populate fields on the winforms
using the FormMapper attribute.But that may not be the only reason why
i need custom attributes. I mite also need to get someinfo about the
fields(like readonly, enabled ) etc from the server.


TIA
 #5  
03-03-08, 07:24 PM
sloan
Maybe this can help:

http://www.jondavis.net/blog/post/20...eneration.aspx

I'm not sure..but check it out.



"parez" <psawant> wrote in message
news:23a6
[..]
 #6  
03-03-08, 08:20 PM
parez
On Mar 3, 3:24 pm, "sloan" <sl> wrote:
> Maybe this can help:
>
> [..]
>
> I'm not sure..but check it out.
>
> "parez" <psaw> wrote in message
>
> news:23a6
>>
>>
>>


Thanks..That is the direction I mite have to go in..

I found more info here

http://msdn2.microsoft.com/en-us/library/aa302301.aspx
 #7  
03-04-08, 07:04 AM
Marc Gravell
The problem is that xsd (either the format or the exe) isn't going to be in
the least bit interested in your attribute. Of couse, having your object
model dictate the UI also might not be the best idea... personally I'd
separate the two concepts completely, perhaps using xml generation if (and
only if) it made sense.

Marc
 #8  
03-04-08, 07:52 PM
parez
On Mar 4, 3:04 am, "Marc Gravell" <marcgrav> wrote:
> The problem is that xsd (either the format or the exe) isn't going to be in
> the least bit interested in your attribute. Of couse, having your object
> model dictate the UI also might not be the best idea... personally I'd
> separate the two concepts completely, perhaps using xml generation if (and
> only if) it made sense.
>
> Marc


Hi Marc,

I finally have a custom code generator which geneerates the
Attributes...
I am using the XSD to create classes because the server is going to
use the same XSD to process my request.
My classes are not part of the business tier. They are a part of the
presentation layer(well.. its sits between the winforms and Server).
I am planning to use reflection to populate the form fields.Thats why
I am using the FormMapper Attribute.
Similar Threads
compile-time error generating custom attributes

hi all, can I create my own compile-time attributes? e.g. an attribute applied to a method and that will generate a compile time error if the method has the wrong...

Partial Classes, .Net 2.0 and Custom Attributes

Hi, I had an aspx pag in .Net 1.1 with a label on it. As such I had a code behind page with a declaration for that label. When I convert to Asp.Net 2.0 the code behind is...

Custom Attributes for Classes, Methods, etc

My client uses a SQL Database to store their usernames and passwords, and I do not believe they have AD...no big deal... I wrote a class to create a generic identity and...

ADMT2 & Custom classes/attributes

Hello, I would like to know what ADMT2 will do when it will encounter custom attributes/classes created by third party applications ? Is there a way to register AD schema...


All times are GMT. The time now is 01:37 AM. | Privacy Policy