Exemplo n.º 1
0
        public void ProcessIdentifierAliases(ParseTreeNode root, DocumentTypeDescriptor targetEntity)
        {
            var ctx = new TreeIteratorContext
            {
                Buffer       = new List <string>(5),
                TargetEntity = targetEntity,
                CachedParts  = m_identifierAliasParts
            };

            IterateTree(root, 0, ctx);
        }
Exemplo n.º 2
0
        public void AddDocumentTypeDescriptor(DocumentTypeDescriptor docType)
        {
            if (docType == null)
            {
                throw new ArgumentNullException("docType");
            }

            var existing = RequireDocumentTypeName(docType.Name);

            if (docType.DocumentType != existing)
            {
                throw new ArgumentException(string.Format(
                                                "Supplied document type id {0} does not match existing id {1} for document type {2}",
                                                docType.DocumentType, existing, docType.Name));
            }
            DocumentTypeDescriptors.Add(docType.DocumentType, docType);
        }
Exemplo n.º 3
0
        public DocumentTypeDescriptor AddDocumentTypeDescriptorWithPrimaryKey(string docTypeName, string baseDatasetName, string primaryKeyFieldName, params object[] data)
        {
            if (string.IsNullOrEmpty(docTypeName))
            {
                throw new ArgumentNullException(docTypeName);
            }

            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            if (data.Length == 0 || 0 != data.Length % 2)
            {
                throw new ArgumentException("Invalid data array length: " + data.Length, "data");
            }

            if (m_fieldsMap == null)
            {
                throw new InvalidOperationException("Cannot invoke AddDocumentTypeDescriptor before BeginDefineDocumentTypes");
            }

            if (m_descriptor == null)
            {
                throw new InvalidOperationException("Cannot invoke AddDocumentTypeDescriptor after Commit was called");
            }

            var docType = m_descriptor.RequireDocumentTypeName(docTypeName);

            var fields = new FieldMetadata[data.Length / 2];

            for (var i = 0; i < fields.Length; i++)
            {
                fields[i] = new FieldMetadata(++m_lastFieldId, (string)data[i * 2], (string)data[i * 2], (DbType)data[i * 2 + 1], docType);
            }

            var result = new DocumentTypeDescriptor(docTypeName, baseDatasetName ?? docTypeName, docType, primaryKeyFieldName, fields.Select(x => x.FieldId).ToArray());

            m_descriptor.AddDocumentTypeDescriptor(result);
            foreach (var field in fields)
            {
                m_descriptor.AddField(field);
            }
            return(result);
        }
Exemplo n.º 4
0
        public void Clear()
        {
            IsBulk = false;
            HaveParametersDataInput = false;
            OrdinalOfPrimaryKey     = -1;
            StatementType           = (StatementType)(-1);
            TargetEntity            = null;
            TargetEntityPkField     = null;

            if (Bulk != null)
            {
                Bulk.Detach();
            }

            Select.SelectClauses.Clear();
            Select.SelectFields.Clear();
            Select.OutputColumns.Clear();

            Modify.InsertUpdateSetClauses.Clear();
            Modify.ModifiedFields.Clear();
            Modify.UpdateAssignments.Clear();

            BaseDataset.BaseFieldsMainCount = 0;
            BaseDataset.BaseFields.Clear();
            BaseDataset.WhereClauseFields.Clear();
            BaseDataset.WhereClauseRoot      = null;
            BaseDataset.WhereClauseProcessor = null;
            BaseDataset.OrderClauseFields.Clear();
            BaseDataset.OrderClause     = null;
            BaseDataset.Paging.Offset   = PagingOptions.DefaultPagingOffsetFunc;
            BaseDataset.Paging.PageSize = PagingOptions.DefaultPagingPageSizeFunc;

            BulkInput.BulkInputFields.Clear();

            Params.Names                 = null;
            Params.InputValues           = null;
            Params.InputCollections      = null;
            Params.OrdinalToLocalOrdinal = null;
            Params.DataTypes             = null;

            SpecialCommand.IsSpecialCommand = false;
            SpecialCommand.CommandType      = SpecialCommandData.SpecialCommandType.InvalidValue;
        }