public static DataPropertyCollection FromDao(Dao dao)
        {
            DataPropertyCollection dpc = new DataPropertyCollection();

            typeof(Dao).GetProperties().Where(pi => pi.HasCustomAttributeOfType <ColumnAttribute>()).Each(pi => dpc.Add(pi.Name, pi.GetValue(dao)));
            return(dpc);
        }
        public static T ToInstance <T>(this DataPropertyCollection propertyCollection) where T : class, new()
        {
            T result = new T();

            propertyCollection.Each(dp => result.Property(dp.Name, dp.Value));
            return(result);
        }
        public static DataPropertyCollection GetUpdates(this Dao dao)
        {
            DataPropertyCollection result = new DataPropertyCollection();

            dao.GetNewAssignValues().Each(av => result.Add(av.ColumnName, av.Value));
            return(result);
        }
        public static DataPropertyCollection FromInstance(object instance)
        {
            DataPropertyCollection result = new DataPropertyCollection();

            instance.EachDataProperty((pi, obj) => new DataProperty {
                Name = pi.Name, Value = obj
            }).Each(dp => result.Add(dp));
            return(result);
        }
 public static DataPropertyCollection ToDataPropertyCollection(this object instance)
 {
     return(DataPropertyCollection.FromInstance(instance));
 }
Esempio n. 6
0
 public DataPoint()
 {
     DataPropertyCollection = new DataPropertyCollection();
 }