Пример #1
0
 public ClassEditor(ModelContext context, Class cls)
     : this(context)
 {
     this.cls = cls;
     editmode = true;
 }
Пример #2
0
 public ClassEditor(ModelContext context)
 {
     InitializeComponent();
     this.context = context;
 }
Пример #3
0
 public MemberEditor(ModelContext context, Class cls)
 {
     InitializeComponent();
     this.context = context;
     this.cls = cls;
 }
Пример #4
0
 public MethodEditor(ModelContext context, Class cls)
 {
     this.context = context;
     this.cls = cls;
     InitializeComponent();
 }
Пример #5
0
        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();
        }