Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

adding generated code from a dataset to a class library

Posted on 2007-11-15
9
Medium Priority
?
190 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
URL rewriting in AWS CloudFront

A quick how-to guide to implement with a Lambda function!

 

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 2000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 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