GetConnectionString() 공개 메소드

public GetConnectionString ( ) : string
리턴 string
        public List <SpFarmGroupIdentifier> GetAllowedGroups(string repositoryName, Guid domainId, Guid rootMapId)
        {
            List <SpFarmGroupIdentifier> allowedGroups = new List <SpFarmGroupIdentifier>();

            using (SqlConnection dbConnection = new SqlConnection(_connectionSetting.GetConnectionString()))
            {
                using (SqlCommand dbCommand = new SqlCommand())
                {
                    dbCommand.Connection  = dbConnection;
                    dbCommand.CommandText = "dbo.GetAllowedGroups";
                    dbCommand.CommandType = CommandType.StoredProcedure;
                    dbCommand.Parameters.Add("@DomainId", System.Data.SqlDbType.UniqueIdentifier).Value = domainId;
                    dbCommand.Parameters.Add("@MapId", System.Data.SqlDbType.UniqueIdentifier).Value    = rootMapId;

                    dbConnection.Open();
                    using (SqlDataReader dbReader = dbCommand.ExecuteReader())
                    {
                        while (dbReader.Read())
                        {
                            SpFarmGroupIdentifier newGroupId = new SpFarmGroupIdentifier();
                            newGroupId.SiteCollectionId = dbReader.GetValue <Guid>(_sharePointSiteCollectionIdColumnName);
                            newGroupId.GroupId          = dbReader.GetValue <int>(_sharePointGroupIdColumnName);
                            if (!allowedGroups.Contains(newGroupId))
                            {
                                allowedGroups.Add(newGroupId);
                            }
                        }
                    }
                }
            }

            return(allowedGroups);
        }
예제 #2
0
        public List <DynamicType> GetRootMaps(string repositoryName, Guid domainId, ITypeDescriptorCollection entityFields)
        {
            List <DynamicType> nodes = new List <DynamicType>();

            using (SqlConnection dbConnection = new SqlConnection(_connectionSetting.GetConnectionString()))
            {
                using (SqlCommand dbCommand = new SqlCommand())
                {
                    dbCommand.Connection  = dbConnection;
                    dbCommand.CommandType = CommandType.StoredProcedure;
                    dbCommand.CommandText = "dbo.GetRootMaps";

                    // Get the root maps for all domains unless a domain is specified.
                    if (!domainId.Equals(Guid.Empty))
                    {
                        dbCommand.Parameters.Add("@DomainId", System.Data.SqlDbType.UniqueIdentifier).Value = @domainId;
                    }

                    dbConnection.Open();
                    nodes = ReadNodes(dbCommand, repositoryName, entityFields);
                }
            }

            return(nodes);
        }