// // Copyright by the Spark Development Network // // Licensed under the Rock Community License (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.rockrms.com/license // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // using System; using System.Collections.Generic; using System.ComponentModel.Composition; using Rock.Extension; namespace Rock.Security { /// /// MEF Container class for Binary File BackgroundCheck Components /// public class BackgroundCheckContainer : Container { /// /// Singleton instance /// private static readonly Lazy instance = new Lazy( () => new BackgroundCheckContainer() ); /// /// Gets the instance. /// /// /// The instance. /// public static BackgroundCheckContainer Instance { get { return instance.Value; } } /// /// Gets the component with the matching Entity Type Name. /// /// Type of the entity. /// public static BackgroundCheckComponent GetComponent( string entityType ) { return Instance.GetComponentByEntity( entityType ); } /// /// Gets the name. /// /// Type of the entity. /// public static string GetComponentName( string entityType ) { return Instance.GetComponentNameByEntity( entityType ); } /// /// Gets the active component. /// /// public static BackgroundCheckComponent GetActiveComponent() { foreach ( var indexType in BackgroundCheckContainer.Instance.Components ) { var component = indexType.Value.Value; if ( component.IsActive ) { return component; } } return null; } /// /// Gets or sets the MEF components. /// /// /// The MEF components. /// [ImportMany( typeof( BackgroundCheckComponent ) )] protected override IEnumerable> MEFComponents { get; set; } } }