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

Incorrect type check in DefinitionBuilder.AddContainable #136

Closed
bherila opened this issue Apr 9, 2013 · 0 comments
Closed

Incorrect type check in DefinitionBuilder.AddContainable #136

bherila opened this issue Apr 9, 2013 · 0 comments
Milestone

Comments

@bherila
Copy link
Contributor

bherila commented Apr 9, 2013

Hi,
there is a method N2.Definitions.Static.DefinitionBuilder.AddContainable which performs the following type check:

Type editableType = EnsureType<IEditable>(editable.Type);

before doing anything.

The thing that it may be called for the Editabled and Containers as well. Please see N2.Definitions.Static.DefinitionBuilder.UpdateDefinitionFromConfiguration method.
And in case of Containers, exception will be thrown since Container is not IEditable.

Seems to be that its better to check for IContainable rather than for IEditable: Type editableType = EnsureType<IContainable>(editable.Type);
since casting from IEditable to IContainable is possible, or perform different type check per each case.

N2CMS 2.2.1

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

No branches or pull requests

1 participant