Skip to content
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

GetModelContentType: throw exception when no UmbracoContext exists #224

Open
wants to merge 1 commit into
base: v8/dev
Choose a base branch
from

Conversation

ronaldbarendse
Copy link

This 'fixes' issue #222 and should be able to get merged with PR #223.

Instead of throwing an ArgumentNullException, this method now throws an InvalidOperationException indicating it requires an UmbracoContext to be present.

To make it all work, callers should ensure this using IUmbracoContextFactory.EnsureUmbracoContext() as described in #222 (comment).

If you only need the property alias, the new GetModelPropertyTypeAlias method from PR #223 (comment) doesn't require the UmbracoContext.

@ronaldbarendse
Copy link
Author

After merging with #223, the following XML documentation should be added to the GetModelContentType method (above the ArgumentOutOfRangeException):

/// <exception cref="InvalidOperationException">This method requires an UmbracoContext, ensure this is created using IUmbracoContextFactory.EnsureUmbracoContext().</exception>

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

Successfully merging this pull request may close these issues.

1 participant