Skip to content

Static class decorated with [Coalesce, Service] fail code generation without console error #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
COsborn2 opened this issue May 8, 2020 · 0 comments

Comments

@COsborn2
Copy link
Contributor

COsborn2 commented May 8, 2020

When a static class is decorated with [Coalesce, Service] Coalesce generates invalid C# without providing error output in the Coalesce task.

Static class

namespace IntelliTect.MyApplication.Data
{
    [Coalesce]
    [Service]
    public static class UserService
    {
        public static UserInfo UserInfo(ClaimsPrincipal user)
        {
            return new UserInfo
            {
                IsLoggedIn = user.IsLoggedIn(),
                UserName = user.GetUserName(),
            };
        }
    }

    public class UserInfo
    {
        public bool IsLoggedIn { get; set; }
        public string UserName { get; set; }
    }
}

Generated Controller

namespace IntelliTect.MyApplication.Web.Api
{
    [Route("api/UserService")]
    [ServiceFilter(typeof(IApiActionFilter))]
    public partial class UserServiceController : Controller
    {
        protected IntelliTect.MyApplication.Data.UserService Service { get; }

        public UserServiceController(IntelliTect.MyApplication.Data.UserService service)
        {
            Service = service;
        }
    }
}

"Property cannot be of static class type 'IntelliTect.MyApplication.Data.UserService'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant