示例#1
0
        // GET: RolesController
        public ActionResult Index()
        {
            IVoyagerModel model     = ObjectInstance.GetGenericInstanceOfDifferentAssembly <IVoyagerModel>("Role");
            var           tableName = model["TableName"].ToString();

            var query = db.Query(tableName);

            if (model.checkFunc("LocalScope"))
            {
                query = model.func("LocalScope", new object[] { query }) as Query;
            }

            var result = query.Get();


            // Bread Browse column list
            var identityColumn   = "Id";
            var browseColumnList = new string[] { "Name", "DisplayName" };

            browseColumnList = browseColumnList.Concat(new[] { identityColumn }).ToArray();


            List <string> listColumns = new List <string>();
            var           columns     = db.Instance().Select($"SELECT name FROM syscolumns WHERE id=OBJECT_ID('{tableName}')").ToArray();

            foreach (var column in columns)
            {
                listColumns.Add(column.name);
            }

            return(View());
        }
示例#2
0
        public IActionResult Index()
        {
            // Get Class Instance
            //https://jeremylindsayni.wordpress.com/2019/02/11/instantiating-a-c-object-from-a-string-using-activator-createinstance-in-net/

            var objectType = ObjectInstance.GetClassType <IVoyagerModel>("User");

            var instantiatedObject = Activator.CreateInstance(objectType) as User;
            // get a property value
            var tableName = instantiatedObject.TableName;



            IVoyagerModel model = (IVoyagerModel)ObjectInstance.GetObjectInstanceOfDifferentAssembly("User");

            var res      = model.func("testfunction");
            var addition = model.func("add", new object[] { 4, 6 });



            // Adding Query Scope Start

            var query = _db.Query("AspNetUsers");

            if (model.checkFunc("LocalScope"))
            {
                query = model.func("LocalScope", new object[] { query }) as Query;
            }

            var result = query.Get();

            // Adding Query Scope End


            // Query
            var users = _db.Query("AspNetUsers").Get();

            return(Ok(users));

            return(View());
        }