Is it possible to modify InitializeComponent() safely?
-
Until recently I have been keeping Data layer objects and task logic as seperate from the UI logic as possible. I have been experimenting with custom user controls and attempting to integrate the custom datalayers with the designer by modifying the InitializeComponent method. I have been successful in integrating my data layer data into the designer, however, it doesn't like to stay. Are there any easy workarounds to this such as a way to tell the designer not to modify a peace of code in the InitializeComponent method?
-
Until recently I have been keeping Data layer objects and task logic as seperate from the UI logic as possible. I have been experimenting with custom user controls and attempting to integrate the custom datalayers with the designer by modifying the InitializeComponent method. I have been successful in integrating my data layer data into the designer, however, it doesn't like to stay. Are there any easy workarounds to this such as a way to tell the designer not to modify a peace of code in the InitializeComponent method?
SlingBlade wrote:
Are there any easy workarounds to this such as a way to tell the designer not to modify a peace of code in the InitializeComponent method?
InitializeComponent is the designers method. You cannot change it because the designer will overwrite your changes. In VS2005 it has been moved out to a separate file which you should not be editing either.
SlingBlade wrote:
I have been successful in integrating my data layer data into the designer
The data layer should be no where near the designer. What ever it is that you have done, it isn't separate the data layer from the presentation layer. The data layer and presentation layer should not meet at all. There should be a business layer in between.
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: Introduction to AJAX (2nd May), SQL Server, Mock Objects My website
-
SlingBlade wrote:
Are there any easy workarounds to this such as a way to tell the designer not to modify a peace of code in the InitializeComponent method?
InitializeComponent is the designers method. You cannot change it because the designer will overwrite your changes. In VS2005 it has been moved out to a separate file which you should not be editing either.
SlingBlade wrote:
I have been successful in integrating my data layer data into the designer
The data layer should be no where near the designer. What ever it is that you have done, it isn't separate the data layer from the presentation layer. The data layer and presentation layer should not meet at all. There should be a business layer in between.
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: Introduction to AJAX (2nd May), SQL Server, Mock Objects My website
I'm going to agree to disagree here. I'm pretty sure it is a lost cause trying to get support for something that is clearly defined as unsupported. Data, business and presentation is how I have always done it, but like I mentioned I am getting into developing custom controls that make the presentation layer much simpler and well defined to what need be accomplished, that and Microsoft offers the ability to define your entire data layer within the presentation layer. The data layer is still seperated with a business layer. I am really looking for a way to bring the schema into the designer so my custom controls can be assigned to the proper datatables that are returned in a data layer method without manually creating the schema for every table within the local Dataset for the control.
-
I'm going to agree to disagree here. I'm pretty sure it is a lost cause trying to get support for something that is clearly defined as unsupported. Data, business and presentation is how I have always done it, but like I mentioned I am getting into developing custom controls that make the presentation layer much simpler and well defined to what need be accomplished, that and Microsoft offers the ability to define your entire data layer within the presentation layer. The data layer is still seperated with a business layer. I am really looking for a way to bring the schema into the designer so my custom controls can be assigned to the proper datatables that are returned in a data layer method without manually creating the schema for every table within the local Dataset for the control.
SlingBlade wrote:
I'm going to agree to disagree here. I'm pretty sure it is a lost cause trying to get support for something that is clearly defined as unsupported.
I'm not entirely sure what you are disagreeing with. I'm suggesting that you cannot change the code in the InitializeComponent method because it is unsupported as Visual Studio will overwrite any changes you make. Then you say you disagree with me because it is a "lost cause trying to get support for something that is clearly defined as unsupported".
SlingBlade wrote:
that and Microsoft offers the ability to define your entire data layer within the presentation layer.
Just because you can do something, doesn't mean you should do something. I can walk up a set of railway tracks. However, doing so is clearly inadvised.
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: Introduction to AJAX (2nd May), SQL Server, Mock Objects Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
SlingBlade wrote:
I'm going to agree to disagree here. I'm pretty sure it is a lost cause trying to get support for something that is clearly defined as unsupported.
I'm not entirely sure what you are disagreeing with. I'm suggesting that you cannot change the code in the InitializeComponent method because it is unsupported as Visual Studio will overwrite any changes you make. Then you say you disagree with me because it is a "lost cause trying to get support for something that is clearly defined as unsupported".
SlingBlade wrote:
that and Microsoft offers the ability to define your entire data layer within the presentation layer.
Just because you can do something, doesn't mean you should do something. I can walk up a set of railway tracks. However, doing so is clearly inadvised.
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: Introduction to AJAX (2nd May), SQL Server, Mock Objects Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
I was refering to Microsoft not providing a way to manually interact with the designer. People come up with new design patterns all the time and I particularly considered what I was trying to accomplish as an innovative compromise to keeping the data layer seperate from the presentation layer but still be able to define how the presentation layer interacts with the data layer more clearly. Sorry for the run on sentence. What I'm trying to get at here is that I am using VS Express and am not currently at liberty to make feature requests directly. Sure modifying InitializeComponent is a bit dangerous, but, it's my machine I'm crashing and it sounds like Microsoft is just being lazy with it's almost limitless supply of resources to not provide a workaround. Since when has Microsoft been about following all standards exactly?
-
I was refering to Microsoft not providing a way to manually interact with the designer. People come up with new design patterns all the time and I particularly considered what I was trying to accomplish as an innovative compromise to keeping the data layer seperate from the presentation layer but still be able to define how the presentation layer interacts with the data layer more clearly. Sorry for the run on sentence. What I'm trying to get at here is that I am using VS Express and am not currently at liberty to make feature requests directly. Sure modifying InitializeComponent is a bit dangerous, but, it's my machine I'm crashing and it sounds like Microsoft is just being lazy with it's almost limitless supply of resources to not provide a workaround. Since when has Microsoft been about following all standards exactly?
SlingBlade wrote:
Sure modifying InitializeComponent is a bit dangerous, but, it's my machine I'm crashing and it sounds like Microsoft is just being lazy with it's almost limitless supply of resources to not provide a workaround.
It occurs to me that since InitialiseComponent is called from the constructor, why not create your own method and call it from the constructor too?
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: Introduction to AJAX (2nd May), SQL Server, Mock Objects Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
SlingBlade wrote:
Sure modifying InitializeComponent is a bit dangerous, but, it's my machine I'm crashing and it sounds like Microsoft is just being lazy with it's almost limitless supply of resources to not provide a workaround.
It occurs to me that since InitialiseComponent is called from the constructor, why not create your own method and call it from the constructor too?
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: Introduction to AJAX (2nd May), SQL Server, Mock Objects Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
That works fine at run time, but does not show up in the designer, even if you do the work before the InitializeComponent call in the constructor. I am thinking I am just going to have to manually define the table schemas in the dataset and have them filled at run time for the clarity I am going for. It is a bit more work and debugging but those are the breaks I guess. Thanks for helping keep me from going too far off on a tangent. It's kind of weird to mention this but even my horoscope that just hit my hotmail is in agreement with you. "Impose a looser, more go-with-the-flow kind of structure on your work habits, and you just might accomplish even more than you hoped. The payoffs may not be immediate, but they'll greatly benefit your future."