public ClassEditor(ModelContext context, Class cls) : this(context) { this.cls = cls; editmode = true; }
public ClassEditor(ModelContext context) { InitializeComponent(); this.context = context; }
public MemberEditor(ModelContext context, Class cls) { InitializeComponent(); this.context = context; this.cls = cls; }
public MethodEditor(ModelContext context, Class cls) { this.context = context; this.cls = cls; InitializeComponent(); }
private void Form1_Load(object sender, EventArgs e) { // init the Context context = new ModelContext(); // check existence of the database if (!context.DatabaseExists()) context.CreateDatabase(); // check existence of common access modifiers, create them if so... var pub = new AccessModifier() { Name = "public" }; if (context.AccessModifierSet.Count() == 0) { context.AccessModifierSet.AddObject(pub); context.AccessModifierSet.AddObject(new AccessModifier() { Name = "private" }); context.AccessModifierSet.AddObject(new AccessModifier() { Name = "protected" }); context.AccessModifierSet.AddObject(new AccessModifier() { Name = "internal" }); context.SaveChanges(); } // check existence of System.Object int count = context.ClassSet.Count(c => c.Name == ObjectClass); if (count > 1) { throw new Exception("Wrong database content"); } else if (count == 0) { context.ClassSet.AddObject(new Class() { Name = ObjectClass, Alias = "object", AccessModifier = pub }); context.SaveChanges(); } // bind list of classes to the context BindClassList(); }