0
在asp.net mvc中,我是這樣做的。如何在Nancy中爲Mongodb ObjectId創建自定義模型聯編程序?
public class ObjectIdBinder : IModelBinder
{
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
var result = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
return new ObjectId(result.AttemptedValue);
}
}
在南希我該怎麼做? 另外你如何在bootstrapper中註冊它?代碼示例?