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

Replacement of EnableEnumPrefixFree ? #904

Closed
WouterVanmulken opened this Issue Feb 1, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@WouterVanmulken

WouterVanmulken commented Feb 1, 2017

In Microsoft.AspNet.OData 6.0.0 config.EnableEnumPrefixFree(enumPrefixFree: true); seems to have dissapeared. Is there a replacement for this or another way to accomplish this ? The documentation still references EnableEnumPrefixFree.

@JoMeesschaert

This comment has been minimized.

Show comment
Hide comment
@JoMeesschaert

JoMeesschaert Feb 3, 2017

The same goes for EnableAlternateKeys. Gone in OData 6 although the
documentation still shows it

JoMeesschaert commented Feb 3, 2017

The same goes for EnableAlternateKeys. Gone in OData 6 although the
documentation still shows it

@dmcallis

This comment has been minimized.

Show comment
Hide comment
@dmcallis

dmcallis Feb 24, 2017

I was able to replace EnableEnumPrefixFree by registering a StringAsEnumResolver in the configureAction of my call to MapODataServiceRoute.

Action<IContainerBuilder> configureAction = (builder => builder .AddService(ServiceLifetime.Transient, typeof(ODataUriResolver), sp => new StringAsEnumResolver() { EnableCaseInsensitive = true }) );

config.MapODataServiceRoute(routeName, routePrefix, configureAction);

dmcallis commented Feb 24, 2017

I was able to replace EnableEnumPrefixFree by registering a StringAsEnumResolver in the configureAction of my call to MapODataServiceRoute.

Action<IContainerBuilder> configureAction = (builder => builder .AddService(ServiceLifetime.Transient, typeof(ODataUriResolver), sp => new StringAsEnumResolver() { EnableCaseInsensitive = true }) );

config.MapODataServiceRoute(routeName, routePrefix, configureAction);

@WouterVanmulken

This comment has been minimized.

Show comment
Hide comment
@WouterVanmulken

WouterVanmulken May 5, 2017

This worked for me although i did use the ODataModelConventionBuilder so i eventually used the following code :

ODataModelBuilder builder = new ODataConventionModelBuilder(config);		
  var routingConventions = ODataRoutingConventions
             .CreateDefaultWithAttributeRouting("odata", config)
             .AsEnumerable();


   var route = config.MapODataServiceRoute(
             routeName: "odata",
             routePrefix: "odata",
             configureAction: containerBuilder => containerBuilder
                 .AddService(ServiceLifetime.Singleton, sp => builder.GetEdmModel())
                 .AddService(ServiceLifetime.Singleton, sp => routingConventions)
                 .AddService(ServiceLifetime.Singleton, typeof(ODataUriResolver), 
                         sp => new StringAsEnumResolver { EnableCaseInsensitive = true })
         );

Sorry for the late reaction and thanks!

WouterVanmulken commented May 5, 2017

This worked for me although i did use the ODataModelConventionBuilder so i eventually used the following code :

ODataModelBuilder builder = new ODataConventionModelBuilder(config);		
  var routingConventions = ODataRoutingConventions
             .CreateDefaultWithAttributeRouting("odata", config)
             .AsEnumerable();


   var route = config.MapODataServiceRoute(
             routeName: "odata",
             routePrefix: "odata",
             configureAction: containerBuilder => containerBuilder
                 .AddService(ServiceLifetime.Singleton, sp => builder.GetEdmModel())
                 .AddService(ServiceLifetime.Singleton, sp => routingConventions)
                 .AddService(ServiceLifetime.Singleton, typeof(ODataUriResolver), 
                         sp => new StringAsEnumResolver { EnableCaseInsensitive = true })
         );

Sorry for the late reaction and thanks!

@apazureck

This comment has been minimized.

Show comment
Hide comment
@apazureck

apazureck Aug 10, 2017

Hi @WouterVanmulken, @dmcallis,

I do not have the extension method MapODataServiceRoute either. It seems they have removed in in a recent version. How can I still add the configure action now?

UPDATE: Never mind, I got the wrong class (builder instead of config). sry

Regards

apazureck commented Aug 10, 2017

Hi @WouterVanmulken, @dmcallis,

I do not have the extension method MapODataServiceRoute either. It seems they have removed in in a recent version. How can I still add the configure action now?

UPDATE: Never mind, I got the wrong class (builder instead of config). sry

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment