473,769 Members | 3,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Customizing MSDataSetGenera tor output in VS2005

Hi,
I am using a strongly typed dataset in .Net 2.0, and would like all
tables to inherit from a cusomt datatable class instead of DataTable.
The reason for this is that I want some common code excuted on the row
events, and this I want to implement this once in a Table base class.
ie. instead of having this code generated:
public partial class ActivitiesDataT able : System.Data.Dat aTable,
System.Collecti ons.IEnumerable {
I would like the tables to inherit from MyDataSet like this:
public partial class ActivitiesDataT able : CustomDataTable ,
System.Collecti ons.IEnumerable {
1) How can this be achieved. Is it possible to create a custom
generator that inherits from the MSDataSetGenera tor, and override the
parts where the nested table classes are generated ?
2) In what assembly can I find the MSDataSetGenera tor to do this?
3) Now that .Net 2.0 MSDataSetGenera tor uses partial classes for the
DataSet, table and row classes, I could add my code without having it
overridden, but then I would have to edit each and every table and row
class in the generated dataset.
4) What is the best solution to customize the generated typed datasets
?
Regards
Stig Nielsson

Dec 6 '05 #1
3 16878
Stig,

This article should help you. It tells you how to generate code with
custom generators:

http://www.drewnoakes.com/snippets/W...rVisualStudio/

You could easily call into the MSDataSetGenera tor tool, parse the code,
and replace where needed.

You can also try this:

http://www.raboof.com/Projects/VsCod...ratorShim.aspx

Either way, you should call the old code generator, get the code, and
then pass it to CodeDom. Then, you can change your code, output it, and
then send it back.

You are going to take a hit doing this though, since the code will be
constructed, torn apart, then reconstructed again.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Stig Nielsson" <st****@gmail.c om> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi,
I am using a strongly typed dataset in .Net 2.0, and would like all
tables to inherit from a cusomt datatable class instead of DataTable.
The reason for this is that I want some common code excuted on the row
events, and this I want to implement this once in a Table base class.
ie. instead of having this code generated:
public partial class ActivitiesDataT able : System.Data.Dat aTable,
System.Collecti ons.IEnumerable {
I would like the tables to inherit from MyDataSet like this:
public partial class ActivitiesDataT able : CustomDataTable ,
System.Collecti ons.IEnumerable {
1) How can this be achieved. Is it possible to create a custom
generator that inherits from the MSDataSetGenera tor, and override the
parts where the nested table classes are generated ?
2) In what assembly can I find the MSDataSetGenera tor to do this?
3) Now that .Net 2.0 MSDataSetGenera tor uses partial classes for the
DataSet, table and row classes, I could add my code without having it
overridden, but then I would have to edit each and every table and row
class in the generated dataset.
4) What is the best solution to customize the generated typed datasets
?
Regards
Stig Nielsson

Dec 6 '05 #2
thanks for the answer - it looks as a promising idea.

I succeeded in creating and registering a custom code generator, and it
works in VS2005. Now I would like this generator to invoke the
MSDataSetGenera tor to get its generated code, but I dont know how to
achive this (as I don't have much COM experience).

Should I create a reference to a COM object in my project? I have tried
doing this, but cannot find any com object that is called
MSDataSetGenera tor

So when you write

"Either way, you should call the old code generator, get the code, and
then pass it to CodeDom. Then, you can change your code, output it,
and
then send it back. "

how should I do this?

regards

Stig Nielsson

Dec 7 '05 #3
The Xsd.exe tool in the SDK generates the same dataset code as
MSDataset generator, so one solution to my questions above could be to
fork of a process in my generator to create a temporary dataset file,
which I then somehow load into a CodeDom which I then can modify and
write to a souce file.

I am pretty sure this would work, but it seems a bit clumsy. Does any
one have a better idea ?

regards

Stig Nielsson

Dec 8 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1319
by: kjcox | last post by:
I've been using DocBook and XML for quite some time now. It works great for making simple HTML pages, http://gnuware.com/icecast/. I normally use it on RHEL and do not customize anything other than use the "docbook2html" command. It compiles my book and all chapters no problem. However, lately I have been needing to add custom fonts, unique colors to text and headers, and new items not normally covered under the...
4
6691
by: VR | last post by:
I am trying to embed a check box into a FlexGrid's cell, but having a problem when I start scrolling the grid. Here is my MyCheckBox class... class MyCheckBox : CheckBox { void Init ( AxMSFlexGridLib.AxMSFlexGrid oGrid,
3
8347
by: John | last post by:
Hi I am using create user wizard with sql server based membership/roles. I have the following questions; 1. How can I get rid of the security question and answer as I don't need it in my app? 2. How can I get the control to send an email to the "office" so they can authorise the account before it can be activated for the user?
1
2156
by: Joe Reggae | last post by:
In a Windows Forms project (c#, VS2003) I have a dataSet problem I don't understand. Opening the project, this error displays in the VS Task List area ... "The custom tool 'MSDataSetGenerator' failed while processing the file 'dsMain.xsd." In the VS Solution Explorer I have three dataSet files ... + dsMain.xsd
1
1928
by: Peran | last post by:
If I create a simple xslt stylesheet I can quickly test this in VS2005 by pressing the "Show XSLT Output" button rather than running the whole solution. If I then create a xslt stylesheet with some extended functions I have to run the whole solution (adding the extension objects to the XsltArgumentList when calling XslCompiledTransform.Transform). The "Show XSLT Output" function does not work because it does not know where to find the...
0
1369
by: John Olbert | last post by:
I am trying to use a number of Vb6 and Vcp6 ActiveX controls in various Vs2005 C# Windows Form programs. I am trying to use Aximp.exe on the Ocx file and to take the generated Dll's and add them to the Tools window of Vs2005. The files are generated fine but when I attemp to add the Ax….dll file to the Tools list as a .Net tool it indicates that the Dll does not contain any useable tool information. Is there a way to use the managed...
20
1917
by: Ilias Lazaridis | last post by:
IDLE has an output format like this: <type 'object'> <type 'type'> <type 'type'> How can I customize it to become like that: <type 'object'> <type 'type'>
11
2350
by: aaragon | last post by:
Hi everyone. I'm trying to write a class with policy based design (Alexandrescu's Modern C++ Design). I'm not a programmer but an engineer so this is kind of hard for me. Through the use of policies, I want to customize the structure of a class. The idea is to investigate the use of several data structures. One option would be the use of the boost dynamic bitset. Another would be the use of the std::vector. I obtained some code that...
2
1750
by: thecoolone | last post by:
I am trying to implement the yahoo search api using php. I prefer to use PHP serialized to get the result of the search displayed. Right now i get the output like: Array ( =Array ( =web =20800000
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.