0

I have been tasked with updating an ASP.net Visual Studio 2005 project to Visual Studio 2013. The original project used a product called Subsonic version 2.2 and several Telerik controls. I have been able to solve the Telerik DLL issues but have been unable to figure out an issue with this error which appears to be in code generated by Subsonic.

The code below is causing this error "Partial declarations of 'PSD.Tbl_Division' must not specify different base "

using System; 
using System.Text; 
using System.Data;
/// <summary>
/// Strongly-typed collection for the Tbl_Division class.
/// </summary>
[Serializable]
public partial class Tbl_DivisionCollection : ActiveList<Tbl_Division, Tbl_DivisionCollection>
{      
    public Tbl_DivisionCollection() {}

    /// <summary>
    /// Filters an existing collection based on the set criteria. This is an in-memory filter
    /// Thanks to developingchris for this!
    /// </summary>
    /// <returns>Tbl_DivisionCollection</returns>
    public Tbl_DivisionCollection Filter()
    {
        for (int i = this.Count - 1; i > -1; i--)
        {
            Tbl_Division o = this[i];
            foreach (SubSonic.Where w in this.wheres)
            {
                bool remove = false;
                System.Reflection.PropertyInfo pi = o.GetType().GetProperty(w.ColumnName);
                if (pi.CanRead)
                {
                    object val = pi.GetValue(o, null);
                    switch (w.Comparison)
                    {
                        case SubSonic.Comparison.Equals:
                            if (!val.Equals(w.ParameterValue))
                            {
                                remove = true;
                            }
                            break;
                    }
                }
                if (remove)
                {
                    this.Remove(o);
                    break;
                }
            }
        }
        return this;
    }


}
/// <summary>
/// This is an ActiveRecord class which wraps the Tbl_Division table.
/// </summary>
[Serializable]
public partial class Tbl_Division : ActiveRecord<Tbl_Division>, IActiveRecord
{

I am a Junior Programmer and have spent a lot of time reading the posts on this error message and am not able to get my mind wrapped around what I am reading and relate it to my situation.

Can anyone offer an explanation as to why am I getting this error and if possible why would it work in the Visual Studio 2005 but not Visual Studio 2013. Plus how can I correct this situation

Thanks Perry

Dave Hogan
  • 3,201
  • 6
  • 29
  • 54
Perry
  • 1,277
  • 2
  • 17
  • 39

1 Answers1

0

It appears that the Tbl_Division class is declared in two partial classes. The one shown here subclasses ActiveRecord...

public partial class Tbl_Division : ActiveRecord<Tbl_Division>, IActiveRecord

...which seems a little odd, but it's feasible, I guess. The other partial class must be saying something different in terms of its base class. So, that may be the issue for you, according to the error given. Without seeing your other partial class definition, then it's not possible to say for certain.

ManoDestra
  • 6,325
  • 6
  • 26
  • 50
  • Sorry just want to clarify are you saying I should show all of the code – Perry Apr 01 '16 at 18:29
  • If it's possible to see the initial line of each partial class definition of Tbl_Division, rather than just the one you've shown above. Or you can just check it yourself to see if there's a difference in the base class definition. I've added one to my answer. It would be useful to see the other one. – ManoDestra Apr 01 '16 at 18:30
  • e is the first line of code for the other class public partial class Tbl_DivisionCollection : ActiveList – Perry Apr 01 '16 at 18:55
  • There you go then. My answer was correct. They have entirely different base class definitions. This is why you're getting an error. – ManoDestra Apr 01 '16 at 19:06
  • Okay is there anyway I can fix this situation? Wonder Why it worked in visual studio 2005 – Perry Apr 01 '16 at 19:14
  • You'll need to identify which partial declaration is correct and use it for both. If one partial class is generated, then you may have to look at how that's done to fix your issue. No idea why it didn't occur in VS2005, but it may have been a different target framework, perhaps? – ManoDestra Apr 01 '16 at 19:16