private void PasteTable(CustomStoredProcedureCollection customStoredProcedureCollection,
                                XmlNode customStoredProcedureNode,
                                XmlNode columnListNode,
                                XmlNode parameterListNode)
        {
            try
            {
                var customStoredProcedure = customStoredProcedureCollection.Add();
                var id = customStoredProcedure.Id;
                customStoredProcedure.XmlLoad(customStoredProcedureNode);
                customStoredProcedure.SetId(id);
                customStoredProcedure.SetKey(Guid.NewGuid().ToString());
                customStoredProcedure.Name = "[" + customStoredProcedure.Name + "]";
                customStoredProcedure.Columns.Clear();
                customStoredProcedure.Parameters.Clear();

                foreach (XmlNode child in columnListNode)
                {
                    var column = ((ModelRoot)this.Object.Root).Database.CustomStoredProcedureColumns.Add();
                    id = column.Id;
                    column.XmlLoad(child);
                    column.SetId(id);
                    column.SetKey(Guid.NewGuid().ToString());
                    customStoredProcedure.Columns.Add(column.CreateRef());
                    column.ParentRef = customStoredProcedure.CreateRef();
                }

                //Parameters
                foreach (XmlNode node in parameterListNode)
                {
                    var parameter = ((ModelRoot)this.Object.Root).Database.CustomRetrieveRuleParameters.Add();
                    id = parameter.Id;
                    parameter.XmlLoad(node);
                    parameter.SetId(id);
                    parameter.SetKey(Guid.NewGuid().ToString());
                    customStoredProcedure.Parameters.Add(parameter.CreateRef());
                    parameter.ParentTableRef = customStoredProcedure.CreateRef();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #2
0
        //private DateTime _createdDate = DateTime.Now;

        #endregion

        #region Constructor

        public Database(INHydrateModelObject root)
            : base(root)
        {
            _tables = new TableCollection(root);
            _tables.ResetKey(Guid.Empty.ToString());
            _columns = new ColumnCollection(root);
            _columns.ResetKey(Guid.Empty.ToString());
            _relations = new RelationCollection(root);
            _relations.ResetKey(Guid.Empty.ToString());
            _viewRelations = new ViewRelationCollection(root);
            _viewRelations.ResetKey(Guid.Empty.ToString());
            _customViews = new CustomViewCollection(root);
            _customViews.ResetKey(Guid.Empty.ToString());
            _customAggregates = new CustomAggregateCollection(root);
            _customAggregates.ResetKey(Guid.Empty.ToString());
            _customStoredProcedures = new CustomStoredProcedureCollection(root);
            _customStoredProcedures.ResetKey(Guid.Empty.ToString());
            _customViewColumns = new CustomViewColumnCollection(root);
            _customViewColumns.ResetKey(Guid.Empty.ToString());
            _customAggregateColumns = new CustomAggregateColumnCollection(root);
            _customAggregateColumns.ResetKey(Guid.Empty.ToString());
            _customStoredProcedureColumns = new CustomStoredProcedureColumnCollection(root);
            _customStoredProcedureColumns.ResetKey(Guid.Empty.ToString());
            _customRetrieveRules = new CustomRetrieveRuleCollection(root);
            _customRetrieveRules.ResetKey(Guid.Empty.ToString());
            _customRetrieveRuleParameters = new ParameterCollection(root);
            _customRetrieveRuleParameters.ResetKey(Guid.Empty.ToString());
            _functionParameters = new ParameterCollection(root);
            _functionParameters.ResetKey(Guid.Empty.ToString());
            _functions = new FunctionCollection(root);
            _functions.ResetKey(Guid.Empty.ToString());
            _functionColumns = new FunctionColumnCollection(root);
            _functionColumns.ResetKey(Guid.Empty.ToString());

            this.PrecedenceOrderList = new List <Guid>();
        }