Interfaces to represent winforms

P

parez

I am planning to make my winforms implement an interface representing
the data on the forms.
And the interface will be passed to a class which will contain the
data to be populated on the winforms.I am planning to use reflection
to the populate the winforms.
The reason why i am doing it is to keep the separate the data classes
and UI.
In future I mite have to develop an asp.net Application.(all i will
have to do is create webforms which implemtn the interface).


Please comment. ANd TIA


An example of the class which contains data for the AddressForm is
below.


public class AddressRequest
{

public Address()
{
}

[FormMapper("StreetAddress")]
public string StreetAddress { get; set; }

[FormMapper("Address2")]
public string UnitNumber { get; set; }

[FormMapper("City")]
public string City { get; set; }

[FormMapper("State")]
public string State { get; set; }

[FormMapper("Zip")]
public string zip { get; set; }

}


public interface IAddresss

{
string StreetAddress;
string Address2;
string city;
string state;
strring zip;
string country;
}
 
A

Andy

I am planning to make my winforms implement an interface representing
the data on the forms.
And the interface will be passed to a class which will contain the
data to be populated on the winforms.I am planning to use reflection
to the populate the winforms.
The reason why i am doing it is to keep the separate the data classes
and UI.
In future I mite have to develop an asp.net Application.(all i will
have to do is create webforms which implemtn the interface).

Please comment. ANd TIA

An example of the class which contains data for the AddressForm is
below.

public class AddressRequest
{

public Address()
{
}

[FormMapper("StreetAddress")]
public string StreetAddress { get; set; }

[FormMapper("Address2")]
public string UnitNumber { get; set; }

[FormMapper("City")]
public string City { get; set; }

[FormMapper("State")]
public string State { get; set; }

[FormMapper("Zip")]
public string zip { get; set; }

}

public interface IAddresss

{
string StreetAddress;
string Address2;
string city;
string state;
strring zip;
string country;

}

Why not just use a bindingsource?
 
P

parez

I am planning to make my winforms implement an interface representing
the data on the forms.
And the interface will be passed to a class which will contain the
data to be populated on the winforms.I am planning to use reflection
to the populate the winforms.
The reason why i am doing it is to keep the separate the data classes
and UI.
In future I mite have to develop an asp.net Application.(all i will
have to do is create webforms which implemtn the interface).
Please comment. ANd TIA
An example of the class which contains data for the AddressForm is
below.
public class AddressRequest
{
public Address()
{
}
[FormMapper("StreetAddress")]
public string StreetAddress { get; set; }
[FormMapper("Address2")]
public string UnitNumber { get; set; }
[FormMapper("City")]
public string City { get; set; }
[FormMapper("State")]
public string State { get; set; }
[FormMapper("Zip")]
public string zip { get; set; }

public interface IAddresss
{
string StreetAddress;
string Address2;
string city;
string state;
strring zip;
string country;

Why not just use a bindingsource?

I havent used much of bindingsource before. Is the thing going to work
in asp.net forms?
And I like having control wherever I can.(I know that is not a good
selling point)
 
A

Andy

I am planning to make my winforms implement an interface representing
the data on the forms.
And the interface will be passed to a class which will contain the
data to be populated on the winforms.I am planning to use reflection
to the populate the winforms.
The reason why i am doing it is to keep the separate the data classes
and UI.
In future I mite have to develop an asp.net Application.(all i will
have to do is create webforms which implemtn the interface).
Please comment. ANd TIA
An example of the class which contains data for the AddressForm is
below.
public class AddressRequest
{
public Address()
{
}
[FormMapper("StreetAddress")]
public string StreetAddress { get; set; }
[FormMapper("Address2")]
public string UnitNumber { get; set; }
[FormMapper("City")]
public string City { get; set; }
[FormMapper("State")]
public string State { get; set; }
[FormMapper("Zip")]
public string zip { get; set; }
}
public interface IAddresss
{
string StreetAddress;
string Address2;
string city;
string state;
strring zip;
string country;
}
Why not just use a bindingsource?

I havent used much of bindingsource before. Is the thing going to work
in asp.net forms?
And I like having control wherever I can.(I know that is not a good
selling point)

BindingSource is a Windows forms component. I think there may be a
similar control in Asp.Net though.

You can have control, but the problem is you're re-inventing the
wheel. And your code won't be portable to say WPF.
 
P

parez

I am planning to make my winforms implement an interface representing
the data on the forms.
And the interface will be passed to a class which will contain the
data to be populated on the winforms.I am planning to use reflection
to the populate the winforms.
The reason why i am doing it is to keep the separate the data classes
and UI.
In future I mite have to develop an asp.net Application.(all i will
have to do is create webforms which implemtn the interface).
Please comment. ANd TIA
An example of the class which contains data for the AddressForm is
below.
public class AddressRequest
{
public Address()
{
}
[FormMapper("StreetAddress")]
public string StreetAddress { get; set; }
[FormMapper("Address2")]
public string UnitNumber { get; set; }
[FormMapper("City")]
public string City { get; set; }
[FormMapper("State")]
public string State { get; set; }
[FormMapper("Zip")]
public string zip { get; set; }
}
public interface IAddresss
{
string StreetAddress;
string Address2;
string city;
string state;
strring zip;
string country;
}
Why not just use a bindingsource?
I havent used much of bindingsource before. Is the thing going to work
in asp.net forms?
And I like having control wherever I can.(I know that is not a good
selling point)

BindingSource is a Windows forms component. I think there may be a
similar control in Asp.Net though.

You can have control, but the problem is you're re-inventing the
wheel. And your code won't be portable to say WPF.

Hi

I am not longer using the Attributes.. The addressForm class and the
Address class (just an exmpale) will both implement IAddress. I will
use reflection to populate the interface that is passed to my address
class. winform or webform .
Why do you say code will not work in WPF? I mean the code with
attributes. I have not used WPF.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top