public void AddCar(Inventory newCar) { Cars.Add(newCar); using (InventoryDal inventory = (new InventoryDal())) { inventory.InsertAuto(ModelTransformations.InventoryToCar(newCar)); } }
public static string Compile(string modelSourceCode) { var ast = Grammar.Everything.Parse(modelSourceCode); var semanticModel = ModelTransformations.Transform(ast); var codeDom = CodeDomCompiler.Compile(semanticModel); return(CompileToSource(codeDom, GetCSharpProvider())); }
public MainWindowViewModel() { using (InventoryDal cars = (new InventoryDal())) { var allCars = cars.GetAllInventory(); foreach (var car in allCars) { Cars.Add(ModelTransformations.CarToInventory(car)); } } }
public void PersistChanges() { using (InventoryDal inventory = (new InventoryDal())) { foreach (var car in Cars) { if (car.IsChanged) { inventory.UpdateCar(ModelTransformations.InventoryToCar(car)); } } } }
private static ITypeDeclaration ApplyDefaultsOnSingleDeclarationNamespace(TypeDeclaration valueTypeDeclaration) { var input = new AbstractSyntaxTree(null, new[] { new Namespace(new NamespaceName("Test"), new[] { valueTypeDeclaration }) }); var actual = ModelTransformations.Transform(input); var actualDeclaration = (ValueTypeDeclaration)actual.AbstractSyntaxTree.Namespaces.Single().Declarations.Single(); return(actualDeclaration); }
private GeometryModel3D TestSquare() { GeometryModel3D model = new GeometryModel3D(); model.Geometry = StandardSquare.CreateSquare(); ModelTransformations transform = new ModelTransformations(); transform.scale(.5, .5); DiffuseMaterial material = new DiffuseMaterial(); SolidColorBrush brush = new SolidColorBrush(Colors.Black); material.Brush = brush; model.Material = material; model.Transform = transform.getTransformations(); return(model); }