Esempio n. 1
0
        public override void Validate(RootElement root)
        {
            String sort       = String.Empty;
            IList  columnMaps = new ArrayList();

            foreach (ColumnMapElement columnMap in this.ColumnMaps)
            {
                ColumnMapElement columnMapElement = this.entity.FindColumnMap(columnMap.Name);
                if (columnMapElement == null)
                {
                    root.AddValidationMessage(ParserValidationMessage.NewError("Finder column element (" + columnMap.Name + ") was not found for entity (" + this.entity.Name + ")"));
                }
                else
                {
                    columnMaps.Add(columnMap);
                    if (!this.sort.Equals(String.Empty))
                    {
                        sort += ", ";
                    }
                    sort += columnMap.Column.Name;
                }
            }
            if (this.sort.Equals(String.Empty))
            {
                this.sort = sort;
            }
        }
Esempio n. 2
0
        public String GetCReaderString(ColumnMapElement columnMap)
        {
            String readerMethod = String.Format(columnMap.Column.SqlType.ReaderMethodFormat, "dataReader", columnMap.Column.Name);

            if (columnMap.Property.Type.ConvertFromSqlTypeFormat.Length > 0)
            {
                readerMethod = String.Format(columnMap.Property.Type.ConvertFromSqlTypeFormat, "data", columnMap.Property.GetMethodFormat(), readerMethod, "dataReader", columnMap.Column.Name);
            }
            return(readerMethod);
        }
Esempio n. 3
0
        public IList GetPrimaryKeyColumnMaps()
        {
            ArrayList        list     = new ArrayList();
            ColumnMapElement identity = GetIdentityColumnMap();

            if (identity != null)
            {
                list.Add(identity);
            }
            else
            {
                foreach (DataMapElement dataMap in dataMaps)
                {
                    foreach (ColumnMapElement columnMap in dataMap.ColumnMaps)
                    {
                        if (dataMap.SqlEntity.IsPrimaryKeyColumn(columnMap.Column.Name))
                        {
                            list.Add(columnMap);
                        }
                    }
                }
            }
            return(list);
        }
Esempio n. 4
0
        public PropertyElement GetIdentityProperty()
        {
            ColumnMapElement columnMap = GetIdentityColumnMap();

            return(columnMap == null ? null : columnMap.Property);
        }