Domanda

I have a class MyDataRow which I derive from DataRow, here is my code:

public partial class MyDataRow : DataRow
{
    internal MyDataRow(DataRowBuilder builder)
        : base(builder)
    {
        // Initialization of variables
    }
}

The class is partial and has no members because it exists partially in a proto file (members are defined there, too).

Trying to build this produces error CS1729: 'System.Data.DataRow' does not contain a constructor that takes 0 arguments. I'm a bit out of ideas, since I'm calling it explicitly with : base(builder).

What am I missing? :)

edit: Upon request, here's the proto-part:

message SampleDataRow
{
    enum SomeEnum
    {
        ImAValue    = 1;
        MeToo       = 2;
    }

    // Some more enums...

    optional double    _member1    = 30 [default = 0];
    optional double    _member2    = 31 [default = 0];

    // More members...
}
È stato utile?

Soluzione

Protocol Buffers creates a default constructor without arguments for the proto-part of my partial class, which leads to this error. Thanks Matthew Watson for pointing that out.

Scrapping the C#-half of this class and instead working with the proto-definition alone would be a viable solution in my case.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top