Esempio n. 1
0
 public void Add(DynamicProperty property)
 {
     if (property == null)
     {
         throw new ArgumentNullException("property");
     }
     properties.Add(Tuple.Create(property.ForType, property.Name), property);
 }
Esempio n. 2
0
        public void Can_get_property_for_subtypes()
        {
            var properties = new DynamicPropertyProvider();

            properties.Add(DynamicProperty.For <Person>("Test", p => 0));

            DynamicProperty property;

            Assert.True(properties.TryGetProperty(typeof(Employee), "Test", out property));
        }
Esempio n. 3
0
        public void Can_add_dynamic_property_to_object_in_viewmodel()
        {
            dynamic viewmodel = new DynamicViewModel();

            viewmodel.Customer = new Customer {
                Id = 1
            };
            viewmodel.Add(DynamicProperty.For <Customer>("Url", c => "/customer/" + c.Id));

            Assert.Equal("/customer/1", viewmodel.Customer.Url);
        }
Esempio n. 4
0
 public DynamicProperty_For_SomeClass()
 {
     property = DynamicProperty.For <SomeClass>("Test", c => "value");
 }
Esempio n. 5
0
 public void Add(DynamicProperty dynamicProperty)
 {
     dynamicProperties.Add(dynamicProperty);
 }
Esempio n. 6
0
        public bool TryGetProperty(Type forType, string propertyName, out DynamicProperty property)
        {
            var key = Tuple.Create(forType, propertyName);

            return(properties.TryGetValue(key, out property));
        }