CodeInsiders.SharpQL.AssignListBuilder.BuildForObject C# (CSharp) Метод

BuildForObject() публичный Метод

public BuildForObject ( object obj ) : AssignListBuilder
obj object
Результат AssignListBuilder
        public AssignListBuilder BuildForObject(object obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            if (this.tables.Any() == false)
            {
                throw new InvalidOperationException("At least one table must be specified");
            }

            var typeOfObject = obj.GetType();
            var propertiesOfObject = typeOfObject.GetProperties().Where(p => p.CanRead).ToArray();
            foreach (var table in this.tables)
            {
                var tp = this.GetTableProperties(table);
                foreach (var po in propertiesOfObject)
                {
                    var tcol = tp.SingleOrDefault(p => p.Name == po.Name);
                    if (tcol != null)
                    {
                        Expression constantExpr;
                        if (Expression.TryGetConstant(po.GetValue(obj), out constantExpr))
                        {
                            var ea = new ExpressionAssign((Column)tcol.GetValue(table), constantExpr);
                            this.Append(ea);
                        }
                    }
                }
            }
            return this;
        }