Esempio n. 1
0
        public void CreatePropertyNoNotify()
        {
            Table table = new Table
            {
                Name     = "tbl1",
                Schema   = "sch1",
                Database = "db1"
            };

            var asmName = "testAsm" + Guid.NewGuid().ToString();

            var typeBuilder = DynamicTypeBuilder.GetTypeBuilder(table, typeof(PocoBase), asmName);

            var property = DynamicTypeBuilder.CreateProperty(typeBuilder, "prop1", typeof(string), false);

            Assert.AreEqual("get__prop1", property.GetGetMethod(false).Name);
            Assert.AreEqual(typeof(string), property.GetGetMethod(false).ReturnType);
            Assert.AreEqual(MethodAttributes.PrivateScope | MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig, property.GetGetMethod(false).Attributes);
            Assert.AreEqual("set__prop1", property.GetSetMethod(false).Name);
            Assert.AreEqual(MethodAttributes.PrivateScope | MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig, property.GetSetMethod(false).Attributes);
        }