Пример #1
0
 public Join(EntityDbField fieldA, EntityDbField fieldB, JoinType joinType)
 {
     m_JoinID   = 1;
     m_FieldA   = fieldA;
     m_FieldB   = fieldB;
     m_JoinType = joinType;
 }
Пример #2
0
        public EntityDbFieldIndex(EntityDbField indexedColumn)
        {
            if (null == (Object)indexedColumn)
            {
                throw new ArgumentNullException("indexedColumn");
            }

            m_IndexedColumn = indexedColumn;
        }
Пример #3
0
        public void ReadXml(System.Xml.XmlReader r)
        {
            using (XmlReader reader = r.ReadSubtree()) {
                if (reader.Read())
                {
                    while (reader.Read())
                    {
                        if (reader.NodeType == System.Xml.XmlNodeType.Element && !reader.IsEmptyElement)
                        {
                            EntityDbField field = new EntityDbField(
                                XmlConvert.EncodeLocalName(reader.LocalName),
                                (SqlDbType)Enum.Parse(typeof(SqlDbType), reader["dbType"]),
                                Int32.Parse(reader["length"]),
                                GetDbType());

                            int pos;
                            if ((pos = m_FieldMap.BinarySearch(new EntityFieldMapping(field))) >= 0)
                            {
                                if (m_FieldMap[pos].EntityField.FieldType == typeof(Byte[]))
                                {
                                    using (MemoryStream ms = new MemoryStream()) {
                                        Byte[] buffer = new Byte[1024];
                                        int    read   = 0;
                                        while ((read = reader.ReadElementContentAsBase64(buffer, 0, 1024)) > 0)
                                        {
                                            ms.Write(buffer, 0, read);
                                        }

                                        m_FieldMap[pos].EntityField.SetValue(this, ms.ToArray());
                                        ms.Close();
                                    }
                                }
                                else if (m_FieldMap[pos].EntityField.FieldType.IsGenericType && m_FieldMap[pos].EntityField.FieldType.GetGenericTypeDefinition() == typeof(Nullable <>))
                                {
                                    if (m_FieldMap[pos].EntityField.FieldType.GetGenericArguments()[0] == typeof(Guid))
                                    {
                                        m_FieldMap[pos].EntityField.SetValue(this, new Guid(reader.ReadElementContentAsString()));
                                    }
                                    else
                                    {
                                        m_FieldMap[pos].EntityField.SetValue(this, reader.ReadElementContentAs(m_FieldMap[pos].EntityField.FieldType.GetGenericArguments()[0], null));
                                    }
                                }
                                else
                                {
                                    m_FieldMap[pos].EntityField.SetValue(this, reader.ReadElementContentAs(m_FieldMap[pos].EntityField.FieldType, null));
                                }
                            }
                        }
                    }
                }
            }

            r.Read();
        }
Пример #4
0
        public Expression(EntityDbField field, ExpressionOperator op, object value) : this()
        {
            m_Field = field;
            m_Expr  = op;
            m_Value = value;
            if (null == m_Value)
            {
                m_Value = DBNull.Value;
            }

            m_ExpressionID = "expr0";
        }
Пример #5
0
        protected void SetFieldModified(EntityDbField field, bool modified)
        {
            int pos = m_ModifiedFields.BinarySearch(field);

            if (modified)
            {
                if (pos < 0)
                {
                    pos = ~pos;
                    m_ModifiedFields.Insert(pos, field);
                }
            }
            else
            {
                if (pos >= 0)
                {
                    m_ModifiedFields.RemoveAt(pos);
                }
            }
        }
Пример #6
0
 public override object GetValueForDbField(EntityDbField field)
 {
     return(m_FieldValues[m_Fields.BinarySearch(field)]);
 }
Пример #7
0
 public override void SetValueForDbField(EntityDbField field, object value)
 {
     m_FieldValues[m_Fields.BinarySearch(field)] = value;
 }
Пример #8
0
 public EntityCollection(EntityDbField indexColumn)
 {
     m_Index     = new EntityDbFieldIndex(indexColumn);
     m_IsIndexed = true;
 }
Пример #9
0
 public virtual bool GetDbFieldValueChanged(EntityDbField field)
 {
     return(m_ModifiedFields.BinarySearch(field) >= 0);
 }
Пример #10
0
        public virtual void SetValueForDbField(EntityDbField field, object value)
        {
            int pos = m_FieldMap.BinarySearch(new EntityFieldMapping(field));

            m_FieldMap[pos].EntityField.SetValue(this, value);
        }
Пример #11
0
        public virtual object GetValueForDbField(EntityDbField field)
        {
            int pos = m_FieldMap.BinarySearch(new EntityFieldMapping(field));

            return(m_FieldMap[pos].EntityField.GetValue(this));
        }
Пример #12
0
 protected void AddFieldMapping(EntityDbField dbfield, string objfield)
 {
     AddFieldMapping(new EntityFieldMapping(dbfield, objfield, this.GetType()));
 }
Пример #13
0
 protected void AddFieldMapping(EntityDbField dbfield, string objfield, Type objtype)
 {
     AddFieldMapping(new EntityFieldMapping(dbfield, objfield, objtype));
 }
Пример #14
0
 public SortExpression(EntityDbField field, SortDirection direction)
 {
     m_SortDbField  = field;
     m_SorDirection = direction;
 }