コード例 #1
0
        public void UnitTest_CRUD_Read()
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();

            var tarkOrm     = new TarkOrm("localhost");
            var countryList = tarkOrm.GetAll <Country>();
            var country     = tarkOrm.GetById <Country>(30);

            var countryPartial = tarkOrm.GetById <CountryPartial>(30);

            watch.Stop();

            Debugger.Log(0, "", $"TarkORM Elapsed MS: {watch.ElapsedMilliseconds.ToString()}{Environment.NewLine}");
        }
コード例 #2
0
        public void UnitTest_CRUD_Create()
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();

            var tarkOrm = new TarkOrm("localhost");

            if (tarkOrm.GetById <Country>(247) != null)
            {
                tarkOrm.RemoveById <Country>(247);
            }

            tarkOrm.Add(new Country
            {
                CountryID   = 247,
                ContinentID = 1,
                CountryCode = "ND",
                CurrencyID  = 1,
                FlagB64     = "",
                Name        = "Testing Country"
            });

            watch.Stop();

            Debugger.Log(0, "", $"TarkORM Elapsed MS: {watch.ElapsedMilliseconds.ToString()}{Environment.NewLine}");
        }
コード例 #3
0
        public void UnitTest_CRUD_ReadingCharValues()
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();

            var tarkOrm = new TarkOrm("localhost");

            var x = tarkOrm.GetById <TestOrm>(1);

            watch.Stop();

            Debugger.Log(0, "", $"TarkORM Elapsed MS: {watch.ElapsedMilliseconds.ToString()}{Environment.NewLine}");
        }
コード例 #4
0
        public void UnitTest_CRUD_Update()
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();

            var tarkOrm = new TarkOrm("localhost");

            var country = tarkOrm.GetById <Country>(247);

            country.Name        = "Testing Country Update3";
            country.ContinentID = 2;
            country.CountryCode = "YX";
            country.CurrencyID  = 2;
            country.FlagB64     = "ND";
            tarkOrm.Update(country);

            watch.Stop();

            Debugger.Log(0, "", $"TarkORM Elapsed MS: {watch.ElapsedMilliseconds.ToString()}{Environment.NewLine}");
        }
コード例 #5
0
        public void TestGetWhere()
        {
            //var con = new DataConn
            //SqlConnection con = new SqlConnection();

            var data = new TarkOrm("data source=PH03N1XR4V4N-PC\\DBLABS;initial catalog=MyPortal;persist security info=True;user id=app_login;password=ph03n1xr4v3n;MultipleActiveResultSets=True;App=TarkOrm");

            //var item = data.GetById<Country>(10, "AR");

            //Creates a Where function that receives a lambda
            // the returns of lambda is a field / field property
            // Where will adds those fields to a parameter list
            // the final return of the function is a command

            //Command has a property "Execute", that triggers the query

            //var filtered = data.Where(x => x.field, value).Execute();
            //var filtered = data.Where(x => x.field.property???, value).Execute();

            //var filtered = data.Where("colname", value) (?)
            //var a = new Country();

            ////var filtered = data.Where<Country>(1).Execute();

            ////var rowsAffected data.Insert(new country...);
            //del x = ((y) => 1 * 2);

            ////var x = () => 1.ToString();
            //Func<int, bool> myfunc = (q => q == 6);

            //Func<int, string> myfunc2 = (q => q.ToString());

            ////Commands stack before executing? .Execute?

            var item = data.GetById <Country>(10);
            var xpto = GetPropertyInfo(item, w => w.Name);

            var x = data.GetWhere <Country, string>(y => y.Name, "Brazil");
        }
コード例 #6
0
        public void UnitTest_IgnoreMapping()
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();

            var tarkOrm = new TarkOrm("localhost");

            TarkConfigurationMapping.DefaultStringDbType = System.Data.DbType.AnsiString;
            TarkConfigurationMapping.CreateEmptyMapType <TestOrmTestMapping>()
            .MapProperty(x => x.classx, "Classification")
            .MapProperty(x => x.description, "Name")
            .MapProperty(x => x.CreationDate)
            .MapProperty(x => x.Id, new KeyAttribute())
            .ToTable("TestOrm");

            var list = tarkOrm.GetWhere <TestOrmTestMapping, string>(x => x.description, "Polskyman");

            var item = tarkOrm.GetById <TestOrmTestMapping>(1);

            watch.Stop();

            Debugger.Log(0, "", $"TarkORM Elapsed MS: {watch.ElapsedMilliseconds.ToString()}{Environment.NewLine}");
        }