This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static T ItemGetOrSet<T>(this HttpRequestBase request, string key, Func<T> calculator) where T: class | |
{ | |
if (request.RequestContext.HttpContext.Items.Contains(key)) | |
return (T) request.RequestContext.HttpContext.Items[key]; | |
var val = calculator(); | |
request.RequestContext.HttpContext.Items[key] = val; | |
return val; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
namespace DotCheck.Models | |
{ | |
public class QuestionFactory | |
{ | |
public static List<ExamQuestion> FromConfig(ExamConfig config) | |
{ | |
var res = new List<ExamQuestion>(); | |
var currentCategory = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var engine = new FileHelperEngine<RecordClass>(): | |
var context = engine.CreateContext(): // will return a ProcessContext<RecordClass> | |
// e will be of type FieldErrorEventHandler<T> | |
context.Callbacks.OnFieldError = e => { | |
// Fields of e | |
e.Field | |
e.Record | |
e.RecordLine |