예제 #1
0
        public SCAclContainerCollection LoadContainers(IConnectiveSqlClause condition, DateTime timePoint)
        {
            ConnectiveSqlClauseCollection timePointBuilder  = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder(timePoint);
            ConnectiveSqlClauseCollection connectiveBuilder = new ConnectiveSqlClauseCollection(condition, timePointBuilder);

            string sql = string.Format(
                "SELECT * FROM {0} WHERE {1} ORDER BY SortID",
                this.GetLoadingTableName(timePoint),
                connectiveBuilder.ToSqlString(TSqlBuilder.Instance));

            SCAclContainerCollection result = new SCAclContainerCollection();

            AUCommon.DoDbAction(() =>
            {
                using (DbContext context = DbContext.GetContext(this.GetConnectionName()))
                {
                    using (IDataReader reader = DbHelper.RunSqlReturnDR(sql, this.GetConnectionName()))
                    {
                        ORMapping.DataReaderToCollection(result, reader);
                    }
                }
            });

            return(result);
        }
예제 #2
0
        public void Load(System.IO.TextReader input)
        {
            int count;

            var xmlDoc = new System.Xml.XmlDocument();

            xmlDoc.Load(input);
            SchemaObjectXmlImporter importer = new SchemaObjectXmlImporter();

            var nodeContext = xmlDoc.SelectSingleNode("/sc/context");

            if (nodeContext != null)
            {
                var attrTime = nodeContext.Attributes["timeContext"];
                if (attrTime != null && attrTime.Specified)
                {
                    this.timeContext = System.Xml.XmlConvert.ToDateTime(attrTime.Value, System.Xml.XmlDateTimeSerializationMode.Local);
                }

                var scope = nodeContext.Attributes["scope"];
                if (scope != null && scope.Specified)
                {
                    this.Scope = scope.Value;
                }
            }

            var nodeObjects = xmlDoc.SelectNodes("/sc/objects/Object");

            this.objects = null;
            count        = nodeObjects.Count;

            if (count > 0)
            {
                this.objects = new SchemaObjectCollection();

                for (int i = 0; i < count; i++)
                {
                    var xml        = nodeObjects[i].OuterXml;
                    var schemaType = nodeObjects[i].Attributes["SchemaType"].Value;
                    this.objects.Add(importer.XmlToObject(xml, schemaType));
                }
            }

            nodeObjects    = xmlDoc.SelectNodes("/sc/relations/Object");
            this.relations = null;
            count          = nodeObjects.Count;

            if (count > 0)
            {
                this.relations = new SCRelationObjectCollection();

                for (int i = 0; i < count; i++)
                {
                    var xml        = nodeObjects[i].OuterXml;
                    var schemaType = nodeObjects[i].Attributes["SchemaType"].Value;
                    this.relations.Add((SCRelationObject)importer.XmlToObject(xml, schemaType));
                }
            }

            nodeObjects     = xmlDoc.SelectNodes("/sc/membership/Object");
            this.membership = null;
            count           = nodeObjects.Count;

            if (count > 0)
            {
                this.membership = new SCMemberRelationCollection();

                for (int i = 0; i < count; i++)
                {
                    var xml        = nodeObjects[i].OuterXml;
                    var schemaType = nodeObjects[i].Attributes["SchemaType"].Value;
                    this.membership.Add((SCSimpleRelationBase)importer.XmlToObject(xml, schemaType));
                }
            }

            nodeObjects     = xmlDoc.SelectNodes("/sc/conditions/condition");
            this.conditions = null;
            count           = nodeObjects.Count;

            if (count > 0)
            {
                this.conditions = new MCS.Library.SOA.DataObjects.Security.Conditions.SCConditionCollection();

                for (int i = 0; i < count; i++)
                {
                    var xml = nodeObjects[i];

                    var condition = LoadCondition(xml);

                    this.conditions.Add(condition);
                }
            }

            nodeObjects = xmlDoc.SelectNodes("/sc/acls/acl");
            this.acls   = null;
            count       = nodeObjects.Count;

            if (count > 0)
            {
                this.acls = new SCAclContainerCollection();

                for (int i = 0; i < count; i++)
                {
                    var xml = nodeObjects[i];

                    var acl = LoadAcl(xml);

                    this.acls.Add(acl);
                }
            }
        }
예제 #3
0
		public SCAclContainerCollection LoadContainers(IConnectiveSqlClause condition, DateTime timePoint)
		{
			ConnectiveSqlClauseCollection timePointBuilder = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder(timePoint);
			ConnectiveSqlClauseCollection connectiveBuilder = new ConnectiveSqlClauseCollection(condition, timePointBuilder);

			string sql = string.Format(
				"SELECT * FROM {0} WHERE {1} ORDER BY SortID",
				this.GetLoadingTableName(timePoint),
				connectiveBuilder.ToSqlString(TSqlBuilder.Instance));

			SCAclContainerCollection result = new SCAclContainerCollection();

			using (DbContext context = DbContext.GetContext(this.GetConnectionName()))
			{
				using (IDataReader reader = DbHelper.RunSqlReturnDR(sql, this.GetConnectionName()))
				{
					ORMapping.DataReaderToCollection(result, reader);

					return result;
				}
			}
		}
예제 #4
0
		public void Load(System.IO.TextReader input)
		{
			int count;

			var xmlDoc = new System.Xml.XmlDocument();
			xmlDoc.Load(input);
			SchemaObjectXmlImporter importer = new SchemaObjectXmlImporter();

			var nodeContext = xmlDoc.SelectSingleNode("/sc/context");
			if (nodeContext != null)
			{
				var attrTime = nodeContext.Attributes["timeContext"];
				if (attrTime != null && attrTime.Specified)
				{
					this.timeContext = System.Xml.XmlConvert.ToDateTime(attrTime.Value, System.Xml.XmlDateTimeSerializationMode.Local);
				}

				var scope = nodeContext.Attributes["scope"];
				if (scope != null && scope.Specified)
				{
					this.Scope = scope.Value;
				}
			}

			var nodeObjects = xmlDoc.SelectNodes("/sc/objects/Object");
			this.objects = null;
			count = nodeObjects.Count;

			if (count > 0)
			{
				this.objects = new SchemaObjectCollection();

				for (int i = 0; i < count; i++)
				{
					var xml = nodeObjects[i].OuterXml;
					var schemaType = nodeObjects[i].Attributes["SchemaType"].Value;
					this.objects.Add(importer.XmlToObject(xml, schemaType));
				}
			}

			nodeObjects = xmlDoc.SelectNodes("/sc/relations/Object");
			this.relations = null;
			count = nodeObjects.Count;

			if (count > 0)
			{
				this.relations = new SCRelationObjectCollection();

				for (int i = 0; i < count; i++)
				{
					var xml = nodeObjects[i].OuterXml;
					var schemaType = nodeObjects[i].Attributes["SchemaType"].Value;
					this.relations.Add((SCRelationObject)importer.XmlToObject(xml, schemaType));
				}
			}

			nodeObjects = xmlDoc.SelectNodes("/sc/membership/Object");
			this.membership = null;
			count = nodeObjects.Count;

			if (count > 0)
			{
				this.membership = new SCMemberRelationCollection();

				for (int i = 0; i < count; i++)
				{
					var xml = nodeObjects[i].OuterXml;
					var schemaType = nodeObjects[i].Attributes["SchemaType"].Value;
					this.membership.Add((SCSimpleRelationBase)importer.XmlToObject(xml, schemaType));
				}
			}

			nodeObjects = xmlDoc.SelectNodes("/sc/conditions/condition");
			this.conditions = null;
			count = nodeObjects.Count;

			if (count > 0)
			{
				this.conditions = new MCS.Library.SOA.DataObjects.Security.Conditions.SCConditionCollection();

				for (int i = 0; i < count; i++)
				{
					var xml = nodeObjects[i];

					var condition = LoadCondition(xml);

					this.conditions.Add(condition);
				}
			}

			nodeObjects = xmlDoc.SelectNodes("/sc/acls/acl");
			this.acls = null;
			count = nodeObjects.Count;

			if (count > 0)
			{
				this.acls = new SCAclContainerCollection();

				for (int i = 0; i < count; i++)
				{
					var xml = nodeObjects[i];

					var acl = LoadAcl(xml);

					this.acls.Add(acl);
				}
			}
		}