private string GetModelValue(IModelValueProviderFactory factory, IDictionary<string, object> documentHost, object model, StringLiteralPartType type, string data) { Type modelType = model != null ? model.GetType() : null; object value; switch (type) { case StringLiteralPartType.Encoded: //get the valuetype if (factory.Get(modelType).GetValue(documentHost, model, data, out value)) { return System.Net.WebUtility.HtmlEncode(value.ToString()); } break; case StringLiteralPartType.Raw: if (factory.Get(modelType).GetValue(documentHost, model, data, out value)) { return value.ToString(); } break; } //default type is string literal return data; }
private string GetModelValue(IModelValueProviderFactory factory, IDictionary <string, object> documentHost, object model, StringLiteralPartType type, string data) { Type modelType = model != null?model.GetType() : null; object value; switch (type) { case StringLiteralPartType.Encoded: //get the valuetype if (factory.Get(modelType).GetValue(documentHost, model, data, out value)) { return(System.Net.WebUtility.HtmlEncode(value.ToString())); } break; case StringLiteralPartType.Raw: if (factory.Get(modelType).GetValue(documentHost, model, data, out value)) { return(value.ToString()); } break; } //default type is string literal return(data); }
private string GetModelValue(IModelValueProviderFactory factory, object model, StringLiteralPartType type, string data) { switch (type) { case StringLiteralPartType.Encoded: return System.Net.WebUtility.HtmlEncode((string)factory.Get(model.GetType()).GetValue(model, Parrot.Infrastructure.ValueType.Property, data)); case StringLiteralPartType.Raw: return (string)factory.Get(model.GetType()).GetValue(model, Parrot.Infrastructure.ValueType.Property, data); } //default type is string literal return data; }
private string GetModelValue(IModelValueProviderFactory factory, object model, StringLiteralPartType type, string data) { switch (type) { case StringLiteralPartType.Encoded: return(System.Net.WebUtility.HtmlEncode((string)factory.Get(model.GetType()).GetValue(model, Parrot.Infrastructure.ValueType.Property, data))); case StringLiteralPartType.Raw: return((string)factory.Get(model.GetType()).GetValue(model, Parrot.Infrastructure.ValueType.Property, data)); } //default type is string literal return(data); }
public NancyParrotHost(IModelValueProviderFactory modelValueProviderFactory, IPathResolver pathResolver) { ModelValueProviderFactory = modelValueProviderFactory; PathResolver = pathResolver; RendererFactory = new DefaultRendererFactory(this); }
public ParrotViewEngine(IModelValueProviderFactory modelValueProviderFactory) { _modelValueProviderFactory = modelValueProviderFactory; }