Skip to content

Feature: User defined mapping #92

@fubar-coder

Description

@fubar-coder

It would be nice, if you could define your own mapping for the async-to-sync function conversion.

Example:

NHibernate.Linq.LinqExtensionMethods.ToListAsync=System.Linq.Enumerable.ToList

Currently, this source code generator tries to use NHibernate.Linq.LinqExtensionMethods.ToList, which doesn't exist and requires to write your own class, like:

namespace NHibernate.Linq;

internal static class LinqExtensionMethods
{
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static List<T> ToList<T>(IQueryable<T> query)
        => query.ToList();
}

This, however, comes with its own problems:

  • Complaints that the namespace doesn't match the directory structure/root namespace of the project
  • Warning CS0436, because there is a static class in both the NHibernate assembly and your own project

The mapping could be stored in a file included with AdditionalFiles, like the CsWin32 project does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions