This file contains 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
static IEdmModel GetEdmModel(string url) | |
{ | |
IEdmModel model = null; | |
IEnumerable<EdmError> errors = null; | |
using (var reader = XmlTextReader.Create(url)) | |
{ | |
if (EdmxReader.TryParse(reader, out model, out errors)) | |
{ | |
return model; | |
} |
This file contains 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 Func<T1, TResult> CompileConstructor<T1, TResult>() | |
{ | |
var type1 = typeof(T1); | |
var parameter1 = Expression.Parameter(type1); | |
var constructor = typeof(TResult).GetConstructor(new Type[] { type1 }); | |
var body = Expression.New(constructor, parameter1); | |
var lambda = Expression.Lambda<Func<T1, TResult>>(body, parameter1); | |
var method = lambda.Compile(); | |
return method; | |
} |