Interfaces to represent winforms

  • Thread starter Thread starter parez
  • Start date Start date
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;
}
 
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 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)
 
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.
 
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.
 
Back
Top