Exemple #1
0
        static void Main(string[] args)
        {
            var t = new Test();

            var a = new User();
            a.Value = 9;
            a.Name = "1234567";
            a.Status = 'S';

            t.User = a;

            var db = new DbFramework(typeof(Test));
            db.SetRules();
            var script = db.GetScript(true);

            Validator.ValidateObj(t);

            Console.ReadKey();
        }
        public string GetDependencesScript(DbFramework dbFramework)
        {
            var db = new DbFramework(Property.PropertyType);

            var tableRules = (ITableScript)Activator.CreateInstance(dbFramework.TableScriptRules.GetType());
            var fieldRules = (IFieldScript)Activator.CreateInstance(dbFramework.FieldScriptRules.GetType());
            var constraintRules = (IConstraintScript)Activator.CreateInstance(dbFramework.ConstraintScriptRules.GetType());
            var foreignkeyRules = (IForeignScript)Activator.CreateInstance(dbFramework.ForeignScriptRules.GetType());

            db.SetRules(tableRules, fieldRules, constraintRules, foreignkeyRules);
            return db.GetScript(true);
        }