So the signatures I’m talking about look like this:
protected internal void UpdateModel(TModel model) where
TModel : class {
UpdateModel(model, null, null, null, ValueProvider);
}
protected internal void UpdateModel<TModel>(TModel model, string
prefix) where TModel : class {
UpdateModel(model, prefix, null, null, ValueProvider);
}
protected internal void UpdateModel<TModel>(TModel model,
string[]
includeProperties) where TModel : class {
UpdateModel(model, null, includeProperties, null,
ValueProvider);
}
protected internal void UpdateModel<TModel>(TModel model, string
prefix, string[] includeProperties) where TModel : class {
UpdateModel(model, prefix, includeProperties, null,
ValueProvider);
}
protected internal void UpdateModel<TModel>(TModel model, string
prefix, string[] includeProperties, string[] excludeProperties) where
TModel
: class {
UpdateModel(model, prefix, includeProperties,
excludeProperties,
ValueProvider);
}
protected internal void UpdateModel<TModel>(TModel model,
IDictionary<string, ValueProviderResult> valueProvider) where TModel :
class
{
UpdateModel(model, null, null, null, valueProvider);
}
protected internal void UpdateModel<TModel>(TModel model, string
prefix, IDictionary<string, ValueProviderResult> valueProvider) where
TModel
: class {
UpdateModel(model, prefix, null, null, valueProvider);
}
protected internal void UpdateModel<TModel>(TModel model,
string[]
includeProperties, IDictionary<string, ValueProviderResult>
valueProvider)
where TModel : class {
UpdateModel(model, null, includeProperties, null,
valueProvider);
}
protected internal void UpdateModel<TModel>(TModel model, string
prefix, string[] includeProperties, IDictionary<string,
ValueProviderResult>
valueProvider) where TModel : class {
UpdateModel(model, prefix, includeProperties, null,
valueProvider);
}
protected internal void UpdateModel<TModel>(TModel model, string
prefix, string[] includeProperties, string[] excludeProperties,
IDictionary<string, ValueProviderResult> valueProvider) where TModel :
class
{
bool success = TryUpdateModel(model, prefix,
includeProperties,
excludeProperties, valueProvider);
if (!success) {
string message =
String.Format(CultureInfo.CurrentUICulture,
MvcResources.Controller_UpdateModel_UpdateUnsuccessful,
typeof(TModel).FullName);
throw new InvalidOperationException(message);
}
}
The methods above are defined in ASP.NET MVC but with the current git
build
I can’t call these methods in an inheriting ruby class it will give me
an
error.
when I work around it with:
public new virtual void UpdateModel(TModel model) where
TModel : class
{
UpdateModel(model, null, null, null, ValueProvider);
}
public new virtual void UpdateModel<TModel>(TModel model, string
prefix) where TModel : class
{
UpdateModel(model, prefix, null, null, ValueProvider);
}
public new virtual void UpdateModel<TModel>(TModel model,
string[]
includeProperties) where TModel : class
{
UpdateModel(model, null, includeProperties, null,
ValueProvider);
}
public new virtual void UpdateModel<TModel>(TModel model,
string
prefix, string[] includeProperties) where TModel : class
{
UpdateModel(model, prefix, includeProperties, null,
ValueProvider);
}
public new virtual void UpdateModel<TModel>(TModel model,
string
prefix, string[] includeProperties, string[] excludeProperties) where
TModel
: class
{
UpdateModel(model, prefix, includeProperties,
excludeProperties,
ValueProvider);
}
public new virtual void UpdateModel<TModel>(TModel model,
IDictionary<string, ValueProviderResult> valueProvider) where TModel :
class
{
UpdateModel(model, null, null, null, valueProvider);
}
public new virtual void UpdateModel<TModel>(TModel model,
string
prefix, IDictionary<string, ValueProviderResult> valueProvider) where
TModel
: class
{
UpdateModel(model, prefix, null, null, valueProvider);
}
public new virtual void UpdateModel<TModel>(TModel model,
string[]
includeProperties, IDictionary<string, ValueProviderResult>
valueProvider)
where TModel : class
{
UpdateModel(model, null, includeProperties, null,
valueProvider);
}
public new virtual void UpdateModel<TModel>(TModel model,
string
prefix, string[] includeProperties, IDictionary<string,
ValueProviderResult>
valueProvider) where TModel : class
{
UpdateModel(model, prefix, includeProperties, null,
valueProvider);
}
public new virtual void UpdateModel<TModel>(TModel model,
string
prefix, string[] includeProperties, string[] excludeProperties,
IDictionary<string, ValueProviderResult> valueProvider) where TModel :
class
{
base.UpdateModel(model, prefix,
includeProperties,excludeProperties,valueProvider);
}
things work again in the inheriting controller
def save_user(act)
self.method(:update_model).of(User).call(@user, “user”)
if @user.is_valid
@membership_service.save @user
redirect_to_action('index', 'users')
else
view act.to_s, :layout
end
end
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)