DbConnection

G

Guest

I created my own DbConnection class

using System;
using System.Data;
using System.Data.Common;
using System.Xml;

namespace MyNS
{
public sealed class MyConnection : DbConnection, ICloneable
{
// code implement DbConnection and ICloneable
...
}
}

But Visual Studio 2005 keeps complaining when I try to open this file as
follows:

One or more errors encountered while loading the designer. The errors are
listed below. Some errors can be fixed by rebuilding your project, while
others may require code changes.

The designer must create an instance of type
'System.Data.Common.DbConnection' but it cannot because the type is declared
as abstract.
Hide

at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at
System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at
System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at
System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)


I also see the icon for the file changes and if I remove the DbConnection
that MyConnection is inherited from. It is working fine.

Any ideas about this.
 
T

Tom Winter

I'm doing the same basic thing and getting the same error. I believe it's
because DbConnection (and DbCommand) are descended from Component. I just
right click on the class and select View Code. Everything else seems to work
and it compiles OK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top