Solved

adding generated code from a dataset to a class library

Posted on 2007-11-15
9
187 Views
Last Modified: 2013-11-26
I'm new to working with class libraries.  I know that a class library compiles into an assembly that you can use in your applications.

Here is my question.  I am managing an application that has a class library.   I need to add some new code to the class library and generated an updated assembly.

Outside of the class library project, I have another web application project and I added a new dataset that has two datas tables and two table adapters.  I have a page that uses these table adapters to bind to a couple of repeaters that dispaly the information from the data tables.  All that works fine.

Now, what I want to do, is move the code into the class library and re-compile, so the code from the dataset can be rolled up into the assembly.

I have no idea how to do this?

Can anyone help?  I would greatly appreciate any guidance on how to accomplish this.

Thank you.
0
Comment
Question by:-Dman100-
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20298135
If you are looking to generate dynamic code, then look into CodeDom.  I don't think that you will not be able to modify an existing class library.  You can, however, compile the code in to a separate AppDomain, so that you can load/unload the DLL.

CodeDom Example:

How Do I...Use the CodeDOM to emit source code?
http://quickstart.developerfusion.co.uk/QuickStart/howto/doc/listbuilder.aspx

Bob
0
 

Author Comment

by:-Dman100-
ID: 20298402
Hi Bob,

Thanks for replying to my post.  So, I cannot add the classes created by the Dataset into the existing class library.  Since I have the class library, I can add new classes and re-compile, which is why I thought I could add the classes generated by the dataset into this class library, but there is no way to accomplish that?

Is you suggested, how can I compile the code created by the Dataset as another class library?  Sorry, for the novice questions, I've just never done this before,.

Thanks for your help.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20299037
I think that I misunderstood your question.  I doesn't sound like you aren't talking about generating dynamic code, but more about moving a typed DataSet into a class library.  Is this right?

Bob
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

Author Comment

by:-Dman100-
ID: 20299153
Hi Bob,

Yes, that is correct.  I just want to move the typed Dataset code into the class library and re-compile the assembly so the typed dataset will be included in the assembly.  Am I articulating what I want to accomplish correctly?

Thanks for your help.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20299387
It sounds like you want to put all of your data access stuff into a single DLL.  You should be able to move all the related files for the DataSet into another assembly (if I understand what you're asking), and then add a data access layer class that will be able to work with the DataSet.

Bob
0
 

Author Comment

by:-Dman100-
ID: 20299558
Bob,

Yes, I want to use a single DLL.

How do I move the related files for the Dataset into the class library.  There is already a data access layer in the class library.  I guess I need ot create the new class to work with the DataSet.

Is there an article that describes how to do this?

I'm still relatively new to .NET and know how to create the dataset and bind controls using the TableAdapters created in the dataset, but just not how to move those into a class library.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20300206
1) There are 4 files associated with a typed DataSet:

DataSet1.xsd
DataSet1.Designer.cs
DataSet1.xsc
DataSet1.xss

2) Open Windows Explorer, and move the files from the current folder to the class library folder.  

3) Modify the .csproj to remove the files from the main project, and include them in the class library project.

4) In the data access layer class, create an instance of a typed DataSet, and provide methods to get access to the dataset.

Bob
0
 

Author Comment

by:-Dman100-
ID: 20300375
Sorry to be such a pain, but I had a few questions to the steps you listed.

1)  I see the CustomerService.xsd and CustomerService.xss files, but I don't see the CustomerService.Designer.cs file or the CustomerService.xsc files?  Not sure why?  I don't see them in the AppCode folder?

2) Okay, no problem with this one

3)  Not sure how to modify the .csproj file to accomplish this?

4) I might be asking a completely stupid question here, but when the typed dataset was created, didn't it create the methods that access the data that is populated from the database?

I hope my questions make sense and I'm not completely lost?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 20329700
That description for the files was based on a WinForms application.  For an ASP.NET web site, there would only be the .xsd and the .xss file.

You should be able to use the typed DataSet directly, without any other class required.

Bob
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Amazon S3 Images with .Net 3 62
how to check mis-spellings in a select SQL 2 53
Get sourcecode path 14 63
SSIS GUID Variable 2 57
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question