MapDataReader icon indicating copy to clipboard operation
MapDataReader copied to clipboard

Generation is broken when all class names are not unique

Open ronnieoverby opened this issue 10 months ago • 1 comments

I use a code generator to generate classes to represent my sql schema.

The generator generates code like this:

namespace dbo // schema name
{
    partial class Customers // table name
    {
           partial class RowData
           {
               // property for each column
           }
          
    } 

    partial class Orders// table name
    {
           partial class RowData
           {
               // property for each column
           }
          
    } 
}

In another file I put your attribute on my RowData types:

    [GenerateDataReaderMapper]
    public partial class RowData;

But since I have multiple types with the same name, your generator fails to do anything.

ronnieoverby avatar Apr 05 '24 14:04 ronnieoverby

Same issue here. Would be great to be able to specify either a namespace or a custom extension method name. Preferably both.

Namespace

[GenerateDataReaderMapper(NameSpace = "MyProject.Customers")]
public sealed class Customer;
[GenerateDataReaderMapper(NameSpace = "MyProject.Orders")]
public sealed class Customer;

Method name

[GenerateDataReaderMapper(MethodName = "ToCustomer")]
public sealed class Customer;

...

reader.ToCustomer();
[GenerateDataReaderMapper(MethodName = "ToOrderCustomer")]
public sealed class Customer;

...

reader.ToOrderCustomer();

ShawnTheBeachy avatar May 06 '24 13:05 ShawnTheBeachy