Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 834547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:41:19+00:00 2026-05-15T04:41:19+00:00

I’m working on a huge, old project with a lot of brittle code, some

  • 0

I’m working on a huge, old project with a lot of brittle code, some of which has been around since the .NET 1.0 era, and it has been and will be worked on by other people… so I’d like to change as little as possible.

I have one project in my solution that contains DataSet.xsd. This project compiles to a separate assembly (Data.dll). The database schema includes several tables arranged more or less hierarchically, but the only way the tables are actually linked together is through joins. I can get, e.g. DepartmentRow and EmployeeRow objects from the autogenerated code. EmployeeRow contains information from the employee’s corresponding DepartmentRow through a join.

I’m making a new report to view multiple departments and all their employees. If I use the existing data access scheme, all I will be able to get is a spreadsheet-like output where each employee is represented on one line, with department information repeated over and over in its appropriate columns. E.g.:

Department1...Employee1...
Department1...Employee2...
Department2...Employee3...

But what the customer would like is to have each department render like a heading, with a list of employees beneath each. E.g.:

- Department1...
      Employee1...
      Employee2...
+ Department2...

I’m trying to do this by inheriting hierarchical objects from the autogenerated Row objects. E.g.:

public class Department : DataSet.DepartmentRow {
    public List<Employee> Employees;
}

That way I could nest the data in the report by using a collection of Department objects as the DataSource, each of which will put its list of Employees in a subreport.

The problem is that this gives me a The type Data.DataSet.DepartmentRow has no constructors defined error. And when I try to make a constructor, e.g.

public class Department : DataSet.DepartmentRow {
    private Department() { }
    public List<Employee> Employees;
}

I get a 'Data.DataSet.DepartmentRow(System.Data.DataRowBuilder)' is inaccessible due to its protection level. error in addition to the first one.

Is there a way to accomplish what I’m trying to do? Or is there something else I should be trying entirely?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:41:20+00:00Added an answer on May 15, 2026 at 4:41 am

    I eventually figured out a workaround that has the following benefits:

    1. I don’t have to add a friend to the Data assembly; I only have to modify one file in the part of the assembly where I normally make modifications.
    2. I don’t have to change auto-generated code which will be overwritten as soon as it is re-generated

    In the code-behind file for the dataset (DataSet.cs, acessed in VS2008 by expanding DataSet.xsd), I added a new partial class definition that adds a public constructor with a different signature but which is functionally identical to the existing internal constructor:

    public partial class DataSet {
        public partial class DepartmentRow {
            public DepartmentRow(global::System.Data.DataRowBuilder rb, string discard) : this(rb) { }
        }
        public partial class EmployeeRow {
            public EmployeeRow(global::System.Data.DataRowBuilder rb, string discard) : this(rb) { }
        }
    }
    

    Then, I can use this constructor in my derived class:

    public class Department : DataSet.DepartmentRow {
        public Department(global::System.Data.DataRowBuilder DataRowBuilder rb) : base(rb, "discard") { }
    
        public List<Employee> Employees;
    
        public string[] SomeFrequentlyUsedGroupOfFields {
            get {
                return new string[] { this.OneField, this.AnotherField };
            }
        }
    
        public bool CanUserSeeDepartmentInformation(int UserID) { }
    }
    

    And voila!

    Unfortunately, after achieving this result, I realized that it’s not much use, because the auto-generated code in DataSetTableAdapters.DepartmentTableAdapter still returns objects of type DataSet.DepartmentRow, and I would have to downcast to get my Department object with the extra properties/methods. This is not allowed, and I can’t see an easy way around that fact.

    I could just move all of my new members to the partial class code-behind, but I’m not sure what architecture specs that would violate. (There seems to be some arbitrary application of the distinction between data logic and business logic.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.