Exemplo n.º 1
0
	static void set_fields (BigClass b) {
		b.o31 = 31;
		b.o32 = 32;

		b.o1 = 1;
		b.o2 = 2;
		b.o3 = 3;
		b.o4 = 4;
		b.o5 = 5;
		b.o6 = 6;
		b.o7 = 7;
		b.o8 = 8;
		b.o9 = 9;
		b.o10 = 10;
		b.o11 = 11;
		b.o12 = 12;
		b.o13 = 13;
		b.o14 = 14;
		b.o15 = 15;
		b.o16 = 16;
		b.o17 = 17;
		b.o18 = 18;
		b.o19 = 19;
		b.o20 = 20;
		b.o21 = 21;
		b.o22 = 22;
		b.o23 = 23;
		b.o24 = 24;
		b.o25 = 25;
		b.o26 = 26;
		b.o27 = 27;
		b.o28 = 28;
		b.o29 = 29;
		b.o30 = 30;
	}
Exemplo n.º 2
0
        protected void show(object sender, EventArgs e)
        {
            int pageNumber = 1;

            if (!Int32.TryParse(Request["page"], out pageNumber))
            {
                pageNumber = 1;
            }
            int maxPage     = 0;
            int recordCount = smallclassService.GetRecordCount("");

            if (recordCount % smallclassService.pageCount == 0)
            {
                maxPage = recordCount / smallclassService.pageCount;
            }
            else
            {
                maxPage = recordCount / smallclassService.pageCount + 1;
            }
            smallclassList = smallclassService.FindAllSmall(pageNumber);
            BigClass bigclass = new BigClass();

            bigclassList = bigclassService.GetModelList("");

            foreach (SmallClass smallclass in smallclassList)
            {
                smallclass.BigClassName = bigclassService.GetModel(smallclass.bigid).bigname;
            }
            pageCode = PageUtil.genPagination("/admin/SmallManger.aspx", recordCount, pageNumber, smallclassService.pageCount, "");
        }
Exemplo n.º 3
0
 public void Setup()
 {
     this.bigStruct   = new BigStruct();
     this.bigStruct20 = new BigStruct20();
     this.bigStruct40 = new BigStruct40();
     this.bigClass    = new BigClass();
 }
Exemplo n.º 4
0
        public override bool CreateBigClass(BigClass bigClass)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("Insert Into BigClass(");
            strSql.Append("BigClassId,BigClassName");
            strSql.Append(") Values (");
            strSql.Append("@BigClassId,@BigClassName");
            strSql.Append(")");

            SqlParameter[] parameters = {
                new SqlParameter("@BigClassId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@BigClassName", SqlDbType.NVarChar)
            };
            parameters[0].Value = bigClass.BigClassId;
            parameters[1].Value = bigClass.BigClassName;

            int rows;

            try
            {
                rows = DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
            }
            catch (SqlException ex)
            {
                throw ex;
            }

            return (rows > 0);
        }
Exemplo n.º 5
0
        public static SmallClass MutationAfterRecursionTest(int n)
        {
            var s1 = new BigClass {
                Small = new SmallClass()
            };
            var s2 = MutateAfterRecursion(s1, n);

            return(s2.Small);
        }
Exemplo n.º 6
0
        /// <summary>
        /// The main execution point of the program.
        /// </summary>
        /// <param name="args">The arguments from the command line.</param>
        public static void Main(string[] args)
        {
            Console.WriteLine("Test application");
            Console.WriteLine("Arguments: " + string.Join(", ", args));

            var bigClass = new BigClass();

            bigClass.Do(100);
        }
Exemplo n.º 7
0
        public void TestPerformance(int iterations)
        {
            var big = new BigClass();

            for (var i = 0; i < iterations; i++)
            {
                big.Do(i);
            }
        }
Exemplo n.º 8
0
        public void CheckComplexClass()
        {
            var big = new BigClass()
            {
                ID      = 42,
                Name    = "Babakar",
                Objects = { "one", typeof(BigClass), 33, },
                Values  =
                {
                    ["one"] = 1,
                },
                Other = new BigClass
                {
                    ID   = 101,
                    Name = "what",
                },
            };

            big.Values["meself"] = big;
            big.Objects.Add(big);
            ((BigClass)big.Other).Other = big;

            Action <BigClass> check = (big2) =>
            {
                Assert.Equal(big.ID, big2.ID);
                Assert.Equal(big.Name, big2.Name);
                Assert.Equal(big.Objects.Count, big2.Objects.Count);
                Assert.Equal("one", big2.Objects[0]);
                Assert.Equal(typeof(BigClass), big2.Objects[1]);
                Assert.Equal(33, big2.Objects[2]);
                Assert.Equal(big2, big2.Objects[3]);
                Assert.Equal(big.Values.Count, big2.Values.Count);
                Assert.Equal(1, big2.Values["one"]);
                Assert.Equal(big2, big2.Values["meself"]);
                Assert.IsType <BigClass>(big2.Other);
                var big3 = (BigClass)big2.Other;
                Assert.Equal(101, big3.ID);
                Assert.Equal("what", big3.Name);
                Assert.Equal(big2, big3.Other);
            };

            var text = Serializer.ToSerializedString(big, new SerializationSettings {
                IgnoreISerializable = false
            });
            var text2 = Serializer.ToSerializedString(big, new SerializationSettings {
                IgnoreISerializable = true
            });

            Assert.NotEqual(text, text2);
            check(Serializer.Clone(big, new SerializationSettings {
                IgnoreISerializable = false
            }));
            check(Serializer.Clone(big, new SerializationSettings {
                IgnoreISerializable = true
            }));
        }
Exemplo n.º 9
0
        private static BigClass MutateAfterRecursion(BigClass s, int n)
        {
            int zero = F(n);

            if (s != null && s.Small != null)
            {
                s.Small.Field0 = 53 + zero;
            }
            return(s);
        }
Exemplo n.º 10
0
        public static BigClass CreateInstance(bool isInitDefaultValue)
        {
            BigClass model = new BigClass();

            if (isInitDefaultValue)
            {
                model.BigClassId = Guid.NewGuid();
            }
            return model;
        }
Exemplo n.º 11
0
        /* This sample shows that local's lifetime ends before Sleep, a lot earlier than its lexical scope.
         * This code is JITted into partialy-interruptible code - only safe points are on method calls
         * (please note each such safepoint resets previous tracked slots, so safepoint without any
         * following '+' means - "there are no live slots till now"
         * > !u -gcinfo -o 00007fff43218528
         * Normal JIT generated code
         * CoreCLR.CollectScenarios.Scenarios.EagerRootCollection.SimpleCase(Int32)
         * Begin 00007fff43333450, size 40
         * 0000 00007fff`43333450 57              push    rdi
         * 0001 00007fff`43333451 56              push    rsi
         * 0002 00007fff`43333452 4883ec28        sub     rsp,28h
         * 0006 00007fff`43333456 8bf2            mov     esi,edx
         * 0008 00007fff`43333458 48b9e0af3e43ff7f0000 mov rcx,7FFF433EAFE0h (MT: CoreCLR.CollectScenarios.Scenarios.EagerRootCollection+BigClass)
         * 0012 00007fff`43333462 e81969f65e      call    CoreCLR!JIT_New (00007fff`a2299d80)
         * 00000017 is a safepoint:
         * 0017 00007fff`43333467 488bf8          mov     rdi,rax
         * 001a 00007fff`4333346a 488bcf          mov     rcx,rdi
         * 001d 00007fff`4333346d e87e5cd15c      call    System_Private_CoreLib+0xc890f0 (00007fff`a00490f0) (System.Object..ctor(), mdToken: 0000000006000117)
         * 00000022 is a safepoint:
         * 00000021 +rdi
         * 0022 00007fff`43333472 897708          mov     dword ptr [rdi+8],esi
         * 0025 00007fff`43333475 8b4f08          mov     ecx,dword ptr [rdi+8]
         * 0028 00007fff`43333478 e813d6ffff      call    00007fff`43330a90 (System.Console.Write(Int32), mdToken: 0000000006000093)
         * 0000002d is a safepoint:
         * 002d 00007fff`4333347d b9e8030000      mov     ecx,3E8h
         * 0032 00007fff`43333482 e8e97adf5c      call    System_Private_CoreLib+0xd6af70 (00007fff`a012af70) (Internal.Runtime.Augments.RuntimeThread.Sleep(Int32), mdToken: 00000000060000e7)
         * 00000037 is a safepoint:
         * 0037 00007fff`43333487 33c0            xor     eax,eax
         * 0039 00007fff`43333489 4883c428        add     rsp,28h
         * 003d 00007fff`4333348d 5e              pop     rsi
         * 003e 00007fff`4333348e 5f              pop     rdi
         * 003f 00007fff`4333348f c3              ret
         */
        private int SimpleCase(int value)
        {
            BigClass local = new BigClass()
            {
                Field = value
            };

            local.DoSomething();
            Thread.Sleep(1000);
            return(0);
        }
Exemplo n.º 12
0
 ////添加或者修改,有id修改,无id添加
 public bool SaveOrUpdate(BigClass bigclass)
 {
     if (bigclass.bigid > 0)
     {
         return(dal.Update(bigclass));
     }
     else
     {
         return(dal.Add(bigclass) > 0 ?true : false);
     }
 }
Exemplo n.º 13
0
        public void TestPerformance(int iterations)
        {
            var big = new BigClass();

            List <Task> tasks = new List <Task>();

            for (var i = 0; i < iterations; i++)
            {
                tasks.Add(Task.Run(() => big.Do(i)));
            }

            Task.WaitAll(tasks.ToArray());
        }
Exemplo n.º 14
0
        public void SlamOverloadAndPartialWithIgnore()
        {
            //  given a class with 3 overloaded functions
            Log.Output(@"Current Value of all overloads of OverloadedFunction = " + BigClass.OverloadedFunction(1) +
                       BigClass.OverloadedFunction("string") +
                       BigClass.OverloadedFunction(1.5f));

            //  replace 2 of them
            Injector.SlamClass(typeof(BigClass), typeof(BigClass_PartialSlam));

            Log.Output("New Value of all overloads of OverloadedFunction = " + BigClass.OverloadedFunction(1) +
                       BigClass.OverloadedFunction("string") +
                       BigClass.OverloadedFunction(1.5f));
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //占位标签
            SearchBigId = Int32.Parse(Request["SearchBigId"]);
            BigClassService bigclassService = new BigClassService();
            BigClass        bigClass        = new BigClass();

            bigClass = bigclassService.GetModel(SearchBigId);
            nav      = bigClass.bigname;

            SearchSmallId = Int32.Parse(Request["SearchSmallId"]);
            if (SearchSmallId > 0)
            {
                SmallClassService smallclassService = new SmallClassService();
                SmallClass        smallClass        = new SmallClass();
                smallClass = smallclassService.GetModel(SearchSmallId);
                Code       = smallClass.smallname;

                NoticeService noticeService = new NoticeService();
                NoticeList = noticeService.GetModelList("");
                //分页
                int pageNumber = 1;
                if (!Int32.TryParse(Request["page"], out pageNumber))
                {
                    pageNumber = 1;
                }
                GoodsService goodsService = new GoodsService();
                //goodsList = goodsService.GetModelList("smallid=" +SearchSmallId);
                int maxPage     = 0;
                int recordCount = goodsService.GetRecordCount("smallid=" + SearchSmallId);
                if (recordCount % goodsService.pageCount == 0)
                {
                    maxPage = recordCount / goodsService.pageCount;
                }
                else
                {
                    maxPage = recordCount / goodsService.pageCount + 1;
                }
                if (pageNumber > maxPage)
                {
                    pageNumber = maxPage;
                }
                goodsList = goodsService.FindAllGoodsList(pageNumber, "smallid=" + SearchSmallId);
                pageCode  = PageUtil.genPagination("/goods/GoodsList.aspx", recordCount, pageNumber, goodsService.pageCount, "SearchSmallId=" + SearchSmallId.ToString() + "&SearchBigId=" + SearchBigId);
            }
            else
            {
            }
        }
Exemplo n.º 16
0
        /* This sample shows that local's lifetime ends before loop, a lot earlier than its lexical scope.
         * This code is JITted into fully-interruptible code - safe points are on all most instructions
         * (please note, each line within an interruptible section is safepoint so only differences are
         * printed. For example, at offset 26h, rax content starts to hold live reference.
         * > !u -gcinfo -o 00007fff43218560
         * Normal JIT generated code
         * CoreCLR.CollectScenarios.Scenarios.EagerRootCollection.SimpleCase2(Int32)
         * Begin 00007fff433334b0, size 6c
         * 0000 00007fff`433334b0 57              push    rdi
         * 0001 00007fff`433334b1 56              push    rsi
         * 0002 00007fff`433334b2 4883ec38        sub     rsp,38h
         * 0006 00007fff`433334b6 c5f877          vzeroupper
         * 0009 00007fff`433334b9 c4e17829742420  vmovaps xmmword ptr [rsp+20h],xmm6
         * 0010 00007fff`433334c0 8bf2            mov     esi,edx
         * 00000012 interruptible
         * 0012 00007fff`433334c2 c4e14857f6      vxorps  xmm6,xmm6,xmm6
         * 0017 00007fff`433334c7 48b9e0af3e43ff7f0000 mov rcx,7FFF433EAFE0h (MT: CoreCLR.CollectScenarios.Scenarios.EagerRootCollection+BigClass)
         * 0021 00007fff`433334d1 e8aa68f65e      call    CoreCLR!JIT_New (00007fff`a2299d80)
         * 00000026 +rax
         * 0026 00007fff`433334d6 488bf8          mov     rdi,rax
         * 00000029 +rdi
         * 0029 00007fff`433334d9 488bcf          mov     rcx,rdi
         * 0000002c +rcx
         * 00007fff`433334dc e80f5cd15c      call    System_Private_CoreLib+0xc890f0 (00007fff`a00490f0) (System.Object..ctor(), mdToken: 0000000006000117)
         * 00000031 -rcx -rax
         * 0031 00007fff`433334e1 897708          mov     dword ptr [rdi+8],esi
         * 0034 00007fff`433334e4 8b4f08          mov     ecx,dword ptr [rdi+8]
         * 0037 00007fff`433334e7 e8b8f3ffff      call    00007fff`433328a4 (System.Console.Write(Int32), mdToken: 0000000006000093)
         * 0000003c -rdi
         * 003c 00007fff`433334ec 33ff            xor     edi,edi
         * 003e 00007fff`433334ee 85f6            test    esi,esi
         * 0040 00007fff`433334f0 7e1a            jle     00007fff`4333350c
         * 0042 00007fff`433334f2 c4e17857c0      vxorps  xmm0,xmm0,xmm0
         * 0047 00007fff`433334f7 c4e17b2ac7      vcvtsi2sd xmm0,xmm0,edi
         * 004c 00007fff`433334fc e8af7b835f      call    CoreCLR!COMDouble::Sin (00007fff`a2b6b0b0)
         * 0051 00007fff`43333501 c4e14b58f0      vaddsd  xmm6,xmm6,xmm0
         * 0056 00007fff`43333506 ffc7            inc     edi
         * 0058 00007fff`43333508 3bfe            cmp     edi,esi
         * 005a 00007fff`4333350a 7ce6            jl      00007fff`433334f2
         * 005c 00007fff`4333350c 33c0            xor     eax,eax
         * 0000005e not interruptible
         * 005e 00007fff`4333350e c4e17828742420  vmovaps xmm6,xmmword ptr [rsp+20h]
         * 0065 00007fff`43333515 4883c438        add     rsp,38h
         * 0069 00007fff`43333519 5e              pop     rsi
         * 006a 00007fff`4333351a 5f              pop     rdi
         * 006b 00007fff`4333351b c3              ret
         */
        private int SimpleCase2(int value)
        {
            double   total = 0.0;
            BigClass local = new BigClass()
            {
                Field = value
            };

            local.DoSomething();
            for (int i = 0; i < value; ++i)
            {
                total += Math.Sin(i); // * Math.Pow(i, Math.PI);
            }
            return(0);
        }
Exemplo n.º 17
0
        /* This sample illustrates lexical scope vs lifetime (thanks to JIT's eager root collection).
         * Both local and sc are collected much earlier than their lexical scope.
         * !u -gcinfo 00007ff81c4c8598
         * Normal JIT generated code
         * CoreCLR.CollectScenarios.Scenarios.EagerRootCollection.LexicalScopeExample(Int32)
         * Begin 00007ff81c5e3310, size 71
         * 00007ff8`1c5e3310 57              push    rdi
         * 00007ff8`1c5e3311 56              push    rsi
         * 00007ff8`1c5e3312 4883ec28        sub     rsp,28h
         * 00007ff8`1c5e3316 8bf2            mov     esi,edx
         * 00007ff8`1c5e3318 48b908ad691cf87f0000 mov rcx,7FF81C69AD08h (MT: CoreCLR.CollectScenarios.Scenarios.EagerRootCollection+BigClass)
         * 00007ff8`1c5e3322 e8596af65e      call    CoreCLR!JIT_New (00007ff8`7b549d80)
         * 00000017 is a safepoint:
         * 00007ff8`1c5e3327 488bf8          mov     rdi,rax
         * 00007ff8`1c5e332a 488bcf          mov     rcx,rdi
         * 00007ff8`1c5e332d e8be5d0b5e      call    System_Private_CoreLib+0xc890f0 (00007ff8`7a6990f0) (System.Object..ctor(), mdToken: 0000000006000117)
         * 00000022 is a safepoint:
         * 00000021 +rdi
         * 00007ff8`1c5e3332 897708          mov     dword ptr [rdi+8],esi
         * 00007ff8`1c5e3335 488bcf          mov     rcx,rdi
         * 00007ff8`1c5e3338 e87bf8ffff      call    00007ff8`1c5e2bb8 (CoreCLR.CollectScenarios.Scenarios.EagerRootCollection+BigClass.Check(), mdToken: 000000000600005a)
         * 0000002d is a safepoint:
         * 00007ff8`1c5e333d 85c0            test    eax,eax
         * 00007ff8`1c5e333f 7437            je      00007ff8`1c5e3378
         * 00007ff8`1c5e3341 48b9e8af691cf87f0000 mov rcx,7FF81C69AFE8h (MT: CoreCLR.CollectScenarios.Scenarios.EagerRootCollection+SomeClass)
         * 00007ff8`1c5e334b e8b0e14b5f      call    CoreCLR!JIT_TrialAllocSFastMP_InlineGetThread (00007ff8`7baa1500)
         * 00000040 is a safepoint:
         * 00007ff8`1c5e3350 488bf8          mov     rdi,rax
         * 00007ff8`1c5e3353 488bcf          mov     rcx,rdi
         * 00007ff8`1c5e3356 e8955d0b5e      call    System_Private_CoreLib+0xc890f0 (00007ff8`7a6990f0) (System.Object..ctor(), mdToken: 0000000006000117)
         * 0000004b is a safepoint:
         * 0000004a +rdi
         * 00007ff8`1c5e335b 488bcf          mov     rcx,rdi
         * 00007ff8`1c5e335e 8bd6            mov     edx,esi
         * 00007ff8`1c5e3360 e87bf8ffff      call    00007ff8`1c5e2be0 (CoreCLR.CollectScenarios.Scenarios.EagerRootCollection+SomeClass.CalculateSomething(Int32), mdToken: 0000000006000054)
         * 00000055 is a safepoint:
         * 00007ff8`1c5e3365 8bc8            mov     ecx,eax
         * 00007ff8`1c5e3367 e8047c195e      call    System_Private_CoreLib+0xd6af70 (00007ff8`7a77af70) (Internal.Runtime.Augments.RuntimeThread.Sleep(Int32), mdToken: 00000000060000e7)
         * 0000005c is a safepoint:
         * 00007ff8`1c5e336c b801000000      mov     eax,1
         * 00007ff8`1c5e3371 4883c428        add     rsp,28h
         * 00007ff8`1c5e3375 5e              pop     rsi
         * 00007ff8`1c5e3376 5f              pop     rdi
         * 00007ff8`1c5e3377 c3              ret
         * 00007ff8`1c5e3378 33c0            xor     eax,eax
         * 00007ff8`1c5e337a 4883c428        add     rsp,28h
         * 00007ff8`1c5e337e 5e              pop     rsi
         * 00007ff8`1c5e337f 5f              pop     rdi
         * 00007ff8`1c5e3380 c3              ret
         */

        ///////////////////////////////////////////////////////////////////////
        // Listing 8-5
        private int LexicalScopeExample(int value)
        {
            BigClass local = new BigClass()
            {
                Field = value
            };

            if (local.Check())
            {
                SomeClass sc   = new SomeClass();
                int       data = sc.CalculateSomething(value);
                Thread.Sleep(data); // or DoSomeLongRunningCall(data);
                return(1);
            }
            return(0);
        }
Exemplo n.º 18
0
        protected void SaveOrUpdate(object sender, EventArgs e)
        {
            int BigId;

            if (!Int32.TryParse(Request["bigid"], out BigId))
            {
                BigId = 0;
            }
            string   Bigname  = Request["bigname"];
            BigClass bigclass = new BigClass();

            bigclass.bigid   = BigId;
            bigclass.bigname = Bigname;
            bigclassService.SaveOrUpdate(bigclass);
            this.show(sender, e);
        }
Exemplo n.º 19
0
    // Test marking of objects with > 32 fields
    public static int test_528_mark_runlength_large()
    {
        BigClass b = new BigClass();

        /*
         * Do the initialization in a separate method so no object refs remain in
         * spill slots.
         */
        set_fields(b);

        GC.Collect(1);

        return
            ((int)b.o1 + (int)b.o2 + (int)b.o3 + (int)b.o4 + (int)b.o5 +
             (int)b.o6 + (int)b.o7 + (int)b.o8 + (int)b.o9 + (int)b.o10 +
             (int)b.o11 + (int)b.o12 + (int)b.o13 + (int)b.o14 + (int)b.o15 +
             (int)b.o16 + (int)b.o17 + (int)b.o18 + (int)b.o19 + (int)b.o20 +
             (int)b.o21 + (int)b.o22 + (int)b.o23 + (int)b.o24 + (int)b.o25 +
             (int)b.o26 + (int)b.o27 + (int)b.o28 + (int)b.o29 + (int)b.o30 +
             (int)b.o31 + (int)b.o32);
    }
Exemplo n.º 20
0
    public static void CopyItem <T>(BigClass source, T target)
    {
        // Need a way to rename the backing-field name to the property Name ("<A>k__BackingField" => "A")
        Func <string, string> renameBackingField = key => new string(key.Skip(1).Take(key.IndexOf('>') - 1).ToArray());

        // Get public source properties (change BindingFlags if you need to copy private memebers as well)
        var sourceProperties = source.GetType().GetProperties().ToDictionary(item => item.Name);
        // Get "missing" property setter's backing field
        var targetFields = typeof(T).GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField).ToDictionary(item => renameBackingField(item.Name));

        // Copy properties where target name matches the source property name
        foreach (var sourceProperty in sourceProperties)
        {
            if (targetFields.ContainsKey(sourceProperty.Key) == false)
            {
                continue;     // No match. skip
            }
            var sourceValue = sourceProperty.Value.GetValue(source);
            targetFields[sourceProperty.Key].SetValue(target, sourceValue);
        }
    }
Exemplo n.º 21
0
    static void set_fields(BigClass b)
    {
        b.o31 = 31;
        b.o32 = 32;

        b.o1  = 1;
        b.o2  = 2;
        b.o3  = 3;
        b.o4  = 4;
        b.o5  = 5;
        b.o6  = 6;
        b.o7  = 7;
        b.o8  = 8;
        b.o9  = 9;
        b.o10 = 10;
        b.o11 = 11;
        b.o12 = 12;
        b.o13 = 13;
        b.o14 = 14;
        b.o15 = 15;
        b.o16 = 16;
        b.o17 = 17;
        b.o18 = 18;
        b.o19 = 19;
        b.o20 = 20;
        b.o21 = 21;
        b.o22 = 22;
        b.o23 = 23;
        b.o24 = 24;
        b.o25 = 25;
        b.o26 = 26;
        b.o27 = 27;
        b.o28 = 28;
        b.o29 = 29;
        b.o30 = 30;
    }
Exemplo n.º 22
0
        public BigClass PopulateBigClassFromIDataReader(IDataReader dr)
        {
            BigClass model = null;

            if (dr != null)
            {
                model = new BigClass();

                if (dr["BigClassId"] is System.DBNull)
                    model.BigClassId = null;
                else
                    model.BigClassId = (Guid)dr["BigClassId"];

                model.BigClassName = dr["BigClassName"].ToString();
            }
            return model;
        }
Exemplo n.º 23
0
        public override bool UpdateBigClass(BigClass bigClass)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("Update BigClass Set ");
            strSql.Append(@"BigClassName = @BigClassName");
            strSql.Append(" Where BigClassId = @BigClassId");

            SqlParameter[] paramArray = {
                new SqlParameter("@BigClassId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@BigClassName", SqlDbType.NVarChar)
            };
            paramArray[0].Value = bigClass.BigClassId;
            paramArray[1].Value = bigClass.BigClassName;

            List<SqlParameter> parameters = new List<SqlParameter>();
            parameters.AddRange(paramArray);

            int rows;

            try
            {
                rows = DbHelperSQL.ExecuteSql(strSql.ToString(),parameters.ToArray());
            }
            catch (SqlException ex)
            {
                throw ex;
            }

            return (rows > 0);
        }
Exemplo n.º 24
0
    // Test marking of objects with > 32 fields
    public static int test_528_mark_runlength_large()
    {
        BigClass b = new BigClass();

        /* 
         * Do the initialization in a separate method so no object refs remain in
         * spill slots.
         */
        set_fields(b);

        GC.Collect(1);

        return
            (int)b.o1 + (int)b.o2 + (int)b.o3 + (int)b.o4 + (int)b.o5 +
            (int)b.o6 + (int)b.o7 + (int)b.o8 + (int)b.o9 + (int)b.o10 +
            (int)b.o11 + (int)b.o12 + (int)b.o13 + (int)b.o14 + (int)b.o15 +
            (int)b.o16 + (int)b.o17 + (int)b.o18 + (int)b.o19 + (int)b.o20 +
            (int)b.o21 + (int)b.o22 + (int)b.o23 + (int)b.o24 + (int)b.o25 +
            (int)b.o26 + (int)b.o27 + (int)b.o28 + (int)b.o29 + (int)b.o30 +
            (int)b.o31 + (int)b.o32;
    }
Exemplo n.º 25
0
        protected void show(object sender, EventArgs e)
        {
            BigClass bigclass = new BigClass();

            bigclassList = bigclassService.GetModelList("");
        }
Exemplo n.º 26
0
 public abstract bool UpdateBigClass(BigClass bigClass);
Exemplo n.º 27
0
 public abstract bool CreateBigClass(BigClass bigClass);
Exemplo n.º 28
0
 public static bool Update(BigClass bigClass)
 {
     CommonDataProvider dp = CommonDataProvider.Instance();
     return dp.UpdateBigClass(bigClass);
 }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            //var user = new User();
            //user.MyProperty.Add(new SmallClass
            //{
            //    MyProperty = 1
            //});

            //var user1 = new User();
            //user1.MyProperty.Add(new SmallClass
            //{
            //    MyProperty = 111
            //});
            //user1.MyProperty.Add(new SmallClass
            //{
            //    MyProperty = 222
            //});

            var bigClass = new BigClass
            {
                One   = 1,
                Two   = 1.0M,
                Three = "1",
                Four  = 0,
                Five  = 2,
            };

            var smallClass = new SmallClass
            {
                MyProperty = 1
            };

            var anonObject = new AnonymousObjectsExample();
            var dtoObject1 = new DataTransferObject
            {
                Value = bigClass.Two,
                Type  = bigClass.GetType(),
            };
            var dtoObject2 = new DataTransferObject
            {
                Value = smallClass.MyProperty,
                Type  = smallClass.GetType(),
            };

            // Огромные вычисления :)
            var anonObject3 = new
            {
                Value = bigClass.Two,
                Type  = bigClass.GetType(),
            };
            var dtoObject3ByAnonObject = new DataTransferObject
            {
                Value = anonObject3.Value,
                Type  = anonObject3.Type,
            };

            Console.WriteLine(anonObject3.GetType());
            Console.WriteLine(dtoObject3ByAnonObject.GetType());

            anonObject.Show(dtoObject3ByAnonObject);
            anonObject.Show(dtoObject1);
            anonObject.Show(dtoObject2);

            var listWithValues = new List <int>
            {
                0,
                1,
                2,
                3,
                0,
                4,
                0,
                5,
                0,
            };

            var resultValue1 = new List <ResultObject>();
            var resultValue2 = new List <ResultObject>();
            var resultValue3 = new List <ResultObject>();

            foreach (var item in listWithValues)
            {
                var newTempObject = new ResultObject
                {
                    Value  = item,
                    Result = CheckUp(item)
                };

                resultValue1.Add(newTempObject);
            }
Exemplo n.º 30
0
 private int Helper2(BigClass data, int index)
 {
     return(data.Value1);
 }
Exemplo n.º 31
0
 // now it an be accesable by all method i the class
 public BigFacade()
 {
     _bigclass = new BigClass();
     // setting the initial value to 0
     _bigclass.SetValueI(0);
 }
Exemplo n.º 32
0
 public BigClassFacade()
 {
     _bigClass = new BigClass();
     _bigClass.SetValueI(0);
 }