public void Serialize(BaseReflectionModel model, string fileName) { ClearDB(); DbReflectionModel dbModel = _mapper.Map <DbReflectionModel>(model); dbModel.Name = "DbAssemblyModel"; Context.AssemblyModels.Add(dbModel); Context.SaveChanges(); }
public BaseReflectionModel Deserialize(string path) { Context.ReflectedTypes .Include(t => t.BaseType) .Include(t => t.Fields) .Include(t => t.Constructors) .Include(t => t.Methods) .Include(t => t.Properties) .Include(t => t.ImplementedInterfaces).Load(); Context.NamespaceModels .Include(n => n.Classes) .Include(n => n.Interfaces) .Include(n => n.ValueTypes).Load(); Context.ParameterModels .Include(p => p.ParamType).Load(); Context.PropertyModels .Include(p => p.GetMethod) .Include(p => p.SetMethod) .Include(p => p.Type).Load(); Context.MethodModels .Include(m => m.Parameters) .Include(m => m.ReturnType).Load(); Context.FieldModels .Include(f => f.Type).Load(); DbReflectionModel model = Context.AssemblyModels .Include(a => a.Namespaces) .First() ?? throw new ArgumentException("No such assembly"); return(_mapper.Map <BaseReflectionModel>(model)); }