예제 #1
0
 public HtmlExporter(string filePath, string what)
 {
     _exportServices = new ExportServices();
     _filePath       = filePath;
     _what           = what;
     _total          = _exportServices.GetCountExportItems(what);
 }
예제 #2
0
        private ExportCardinalityCheckResult TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, out IEnumerable <Export> exports)
        {
            Assumes.NotNull(definition);

            exports = GetExportsCore(definition, atomicComposition);

            var checkResult = ExportServices.CheckCardinality(definition, exports);

            // Export providers treat >1 match as zero for cardinality 0-1 imports
            // If this policy is moved we need to revisit the assumption that the
            // ImportEngine made during previewing the only required imports to
            // now also preview optional imports.
            if (checkResult == ExportCardinalityCheckResult.TooManyExports &&
                definition.Cardinality == ImportCardinality.ZeroOrOne)
            {
                checkResult = ExportCardinalityCheckResult.Match;
                exports     = null;
            }

            if (exports == null)
            {
                exports = EmptyExports;
            }

            return(checkResult);
        }
        private Type CheckForLazyAndPartCreator(Type type)
        {
            if (type.IsGenericType)
            {
                Type   genericType = type.GetGenericTypeDefinition();
                Type[] arguments   = type.GetGenericArguments();

                if (genericType == LazyOfTType)
                {
                    this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], null);
                    return(arguments[0]);
                }

                if (genericType == LazyOfTMType)
                {
                    this.MetadataViewType = arguments[1];
                    this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], arguments[1]);
                    return(arguments[0]);
                }

                if (
                    type.FullName.StartsWith(ExportFactoryTypeName, StringComparison.Ordinal) &&
                    ((arguments.Length == 1) || (arguments.Length == 2)))
                {
                    // Func<Tuple<T, Action>>
                    Type            exportLifetimeContextCreatorType = typeof(Func <>).MakeGenericType(typeof(Tuple <,>).MakeGenericType(arguments[0], typeof(Action)));
                    ConstructorInfo constructor = null;

                    if (arguments.Length == 1)
                    {
                        constructor = type.GetConstructor(new Type[] { exportLifetimeContextCreatorType });
                    }
                    else
                    {
                        Assumes.IsTrue(arguments.Length == 2);
                        constructor = type.GetConstructor(new Type[] { exportLifetimeContextCreatorType, arguments[1] });
                    }

                    if (constructor != null)
                    {
                        this.IsPartCreator = true;
                        if (arguments.Length == 1)
                        {
                            this._castSingleValue = ExportServices.CreateStronglyTypedExportFactoryFactory(arguments[0], null, constructor);
                        }
                        else
                        {
                            Assumes.IsTrue(arguments.Length == 2);
                            this._castSingleValue = ExportServices.CreateStronglyTypedExportFactoryFactory(arguments[0], arguments[1], constructor);
                            this.MetadataViewType = arguments[1];
                        }

                        return(arguments[0]);
                    }
                }
            }

            return(type);
        }
예제 #4
0
        private T GetExportedValueCore <T>(string contractName, ImportCardinality cardinality)
        {
            Assumes.IsTrue(cardinality.IsAtMostOne());

            Export export = GetExportsCore(typeof(T), (Type)null, contractName, cardinality).SingleOrDefault();

            return((export != null) ? ExportServices.GetCastedExportedValue <T>(export) : default(T));
        }
        private T?GetExportedValueCore <T>(string?contractName, ImportCardinality cardinality)
        {
            if (!cardinality.IsAtMostOne())
            {
                throw new Exception(SR.Diagnostic_InternalExceptionMessage);
            }

            Export?export = GetExportsCore(typeof(T), (Type?)null, contractName, cardinality).SingleOrDefault();

            return((export != null) ? ExportServices.GetCastedExportedValue <T>(export) : default);
예제 #6
0
        private Type CheckForLazyAndPartCreator(Type type)
        {
            if (type.IsGenericType)
            {
                Type   genericType = type.GetGenericTypeDefinition().UnderlyingSystemType;
                Type[] arguments   = type.GetGenericArguments();

                if (genericType == LazyOfTType)
                {
                    if (!_isOpenGeneric)
                    {
                        this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0].UnderlyingSystemType, null);
                    }
                    return(arguments[0]);
                }

                if (genericType == LazyOfTMType)
                {
                    this.MetadataViewType = arguments[1];
                    if (!_isOpenGeneric)
                    {
                        this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0].UnderlyingSystemType, arguments[1].UnderlyingSystemType);
                    }
                    return(arguments[0]);
                }

                if (genericType != null && IsDescendentOf(genericType, ExportFactoryOfTType))
                {
                    this.IsPartCreator = true;
                    if (arguments.Length == 1)
                    {
                        if (!_isOpenGeneric)
                        {
                            this._castSingleValue = new ExportFactoryCreator(genericType).CreateStronglyTypedExportFactoryFactory(arguments[0].UnderlyingSystemType, null);
                        }
                    }
                    else if (arguments.Length == 2)
                    {
                        if (!_isOpenGeneric)
                        {
                            this._castSingleValue = new ExportFactoryCreator(genericType).CreateStronglyTypedExportFactoryFactory(arguments[0].UnderlyingSystemType, arguments[1].UnderlyingSystemType);
                        }
                        this.MetadataViewType = arguments[1];
                    }
                    else
                    {
                        throw ExceptionBuilder.ExportFactory_TooManyGenericParameters(genericType.FullName);
                    }
                    return(arguments[0]);
                }
            }

            return(type);
        }
        private IEnumerable <Lazy <T> > GetExportsCore <T>(string contractName)
        {
            IEnumerable <Export> exports = this.GetExportsCore(typeof(T), (Type)null, contractName, ImportCardinality.ZeroOrMore);

            Collection <Lazy <T> > result = new Collection <Lazy <T> >();

            foreach (Export export in exports)
            {
                result.Add(ExportServices.CreateStronglyTypedExportOfT <T>(export));
            }
            return(result);
        }
예제 #8
0
        private IEnumerable <Lazy <T, TMetadataView> > GetExportsCore <T, TMetadataView>(string contractName)
        {
            IEnumerable <Export> exports = GetExportsCore(typeof(T), typeof(TMetadataView), contractName, ImportCardinality.ZeroOrMore);

            Collection <Lazy <T, TMetadataView> > result = new Collection <Lazy <T, TMetadataView> >();

            foreach (Export export in exports)
            {
                result.Add(ExportServices.CreateStronglyTypedLazyOfTM <T, TMetadataView>(export));
            }
            return(result);
        }
        private IEnumerable <T> GetExportedValuesCore <T>(string?contractName)
        {
            IEnumerable <Export> exports = GetExportsCore(typeof(T), (Type?)null, contractName, ImportCardinality.ZeroOrMore);

            Collection <T> result = new Collection <T>();

            foreach (Export export in exports)
            {
                result.Add(ExportServices.GetCastedExportedValue <T>(export));
            }
            return(result);
        }
        /// <summary>
        ///     Returns the exports with the specified contract name.
        /// </summary>
        /// <param name="type">
        ///     The <see cref="Type"/> of the <see cref="Export"/> objects to return.
        /// </param>
        /// <param name="metadataViewType">
        ///     The <see cref="Type"/> of the metadata view of the <see cref="Export"/> objects to
        ///     return.
        /// </param>
        /// <param name="contractName">
        ///     A <see cref="string"/> containing the contract name of the
        ///     <see cref="Export"/> object to return; or <see langword="null"/>
        ///     or an empty string ("") to use the default contract name.
        /// </param>
        /// <returns>
        ///     An <see cref="IEnumerable{T}"/> containing the <see cref="Lazy{Object, Object}"/> objects
        ///     with the specified contract name, if found; otherwise, an empty
        ///     <see cref="IEnumerable{T}"/>.
        /// </returns>
        /// <remarks>
        ///     <para>
        ///         The returned <see cref="Export"/> objects are instances of
        ///         <see cref="Lazy{T, TMetadataView}"/> underneath, where <c>T</c>
        ///         is <paramref name="type"/> and <c>TMetadataView</c> is
        ///         <paramref name="metadataViewType"/>.
        ///     </para>
        ///     <para>
        ///         The default contract name is the result of calling
        ///         <see cref="AttributedModelServices.GetContractName(Type)"/> on <paramref name="type"/>.
        ///     </para>
        ///     <para>
        ///         The contract name is compared using a case-sensitive, non-linguistic comparison
        ///         using <see cref="StringComparer.Ordinal"/>.
        ///     </para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="type"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        ///     <paramref name="metadataViewType"/> is not a valid metadata view type.
        /// </exception>
        /// <exception cref="ObjectDisposedException">
        ///     The <see cref="CompositionContainer"/> has been disposed of.
        /// </exception>
        public IEnumerable <Lazy <object, object> > GetExports(Type type, Type?metadataViewType, string?contractName)
        {
            IEnumerable <Export> exports = GetExportsCore(type, metadataViewType, contractName, ImportCardinality.ZeroOrMore);
            Collection <Lazy <object, object> > result = new Collection <Lazy <object, object> >();

            Func <Export, Lazy <object, object> > typedExportFactory = ExportServices.CreateSemiStronglyTypedLazyFactory(type, metadataViewType);

            foreach (Export export in exports)
            {
                result.Add(typedExportFactory.Invoke(export));
            }

            return(result);
        }
            public Tuple <T, Action> GetExportLifetimeContextFromExport <T>(Export export)
            {
                T           exportedValue;
                Action      disposeAction;
                IDisposable disposable = null;

                CatalogExportProvider.ScopeFactoryExport scopeFactoryExport = export as CatalogExportProvider.ScopeFactoryExport;

                if (scopeFactoryExport != null)
                {
                    // Scoped PartCreatorExport
                    Export exportProduct = scopeFactoryExport.CreateExportProduct();
                    exportedValue = ExportServices.GetCastedExportedValue <T>(exportProduct);
                    disposable    = exportProduct as IDisposable;
                }
                else
                {
                    CatalogExportProvider.FactoryExport factoryExport = export as CatalogExportProvider.FactoryExport;

                    if (factoryExport != null)
                    {
                        // PartCreatorExport is the more optimized route
                        Export exportProduct = factoryExport.CreateExportProduct();
                        exportedValue = ExportServices.GetCastedExportedValue <T>(exportProduct);
                        disposable    = exportProduct as IDisposable;
                    }
                    else
                    {
                        // If it comes from somewhere else we walk through the ComposablePartDefinition
                        var factoryPartDefinition = ExportServices.GetCastedExportedValue <ComposablePartDefinition>(export);
                        var part      = factoryPartDefinition.CreatePart();
                        var exportDef = factoryPartDefinition.ExportDefinitions.Single();

                        exportedValue = ExportServices.CastExportedValue <T>(part.ToElement(), part.GetExportedValue(exportDef));
                        disposable    = part as IDisposable;
                    }
                }

                if (disposable != null)
                {
                    disposeAction = () => disposable.Dispose();
                }
                else
                {
                    disposeAction = () => { };
                }

                return(new Tuple <T, Action>(exportedValue, disposeAction));
            }
예제 #12
0
        private static bool TryGetCastFunction(Type genericType, bool isOpenGeneric, Type[] arguments, out Func <Export, object>?castFunction)
        {
            castFunction = null;

            if (genericType == LazyOfTType)
            {
                if (!isOpenGeneric)
                {
                    castFunction = ExportServices.CreateStronglyTypedLazyFactory(arguments[0].UnderlyingSystemType, null);
                }
                return(true);
            }

            if (genericType == LazyOfTMType)
            {
                if (!isOpenGeneric)
                {
                    castFunction = ExportServices.CreateStronglyTypedLazyFactory(arguments[0].UnderlyingSystemType, arguments[1].UnderlyingSystemType);
                }
                return(true);
            }

            if (genericType != null && IsDescendentOf(genericType, ExportFactoryOfTType))
            {
                if (arguments.Length == 1)
                {
                    if (!isOpenGeneric)
                    {
                        castFunction = new ExportFactoryCreator(genericType).CreateStronglyTypedExportFactoryFactory(arguments[0].UnderlyingSystemType, null);
                    }
                    return(true);
                }
                else if (arguments.Length == 2)
                {
                    if (!isOpenGeneric)
                    {
                        castFunction = new ExportFactoryCreator(genericType).CreateStronglyTypedExportFactoryFactory(arguments[0].UnderlyingSystemType, arguments[1].UnderlyingSystemType);
                    }
                    return(true);
                }
                else
                {
                    throw ExceptionBuilder.ExportFactory_TooManyGenericParameters(genericType.FullName !);
                }
            }

            return(false);
        }
예제 #13
0
        //UNDONE: Need to add these warnings somewhere...Dev10:472538 should address this.
        //internal static CompositionResult MatchRequiredMetadata(this IDictionary<string, object> metadata, IEnumerable<string> requiredMetadata, string contractName)
        //{
        //    Assumes.IsTrue(metadata != null);

        //    var result = CompositionResult.SucceededResult;

        //    var missingMetadata = (requiredMetadata == null) ? null : requiredMetadata.Except<string>(metadata.Keys);
        //    if (missingMetadata != null && missingMetadata.Any())
        //    {
        //        result = result.MergeIssue(
        //            CompositionError.CreateIssueAsWarning(CompositionErrorId.RequiredMetadataNotFound,
        //            Strings.RequiredMetadataNotFound,
        //            contractName,
        //            string.Join(", ", missingMetadata.ToArray())));

        //        return new CompositionResult(false, result.Issues);
        //    }

        //    return result;
        //}

        internal static IEnumerable <string> GetRequiredMetadata(Type metadataViewType)
        {
            if ((metadataViewType == null) ||
                ExportServices.IsDefaultMetadataViewType(metadataViewType) ||
                ExportServices.IsDictionaryConstructorViewType(metadataViewType) ||
                !metadataViewType.IsInterface)
            {
                return(Enumerable.Empty <string>());
            }

            // A metadata view is required to be an Intrerface, and therefore only properties are allowed
            IEnumerable <string> requiredMetadata = from property in metadataViewType.GetAllProperties()
                                                    where (property.GetFirstAttribute <DefaultValueAttribute>() == null)
                                                    select property.Name;

            return(requiredMetadata);
        }
예제 #14
0
        private static void EnsureCardinality(ImportDefinition definition, Export[] exports)
        {
            Requires.NullOrNotNullElements(exports, "exports");

            ExportCardinalityCheckResult result = ExportServices.CheckCardinality(definition, exports);

            switch (result)
            {
            case ExportCardinalityCheckResult.NoExports:
                throw new ArgumentException(Strings.Argument_ExportsEmpty, "exports");

            case ExportCardinalityCheckResult.TooManyExports:
                throw new ArgumentException(Strings.Argument_ExportsTooMany, "exports");

            default:
                Assumes.IsTrue(result == ExportCardinalityCheckResult.Match);
                break;
            }
        }
        //UNDONE: Need to add these warnings somewhere...Dev10:472538 should address this.
        //internal static CompositionResult MatchRequiredMetadata(this IDictionary<string, object> metadata, IEnumerable<string> requiredMetadata, string contractName)
        //{
        //    Assumes.IsTrue(metadata != null);

        //    var result = CompositionResult.SucceededResult;

        //    var missingMetadata = (requiredMetadata == null) ? null : requiredMetadata.Except<string>(metadata.Keys);
        //    if (missingMetadata != null && missingMetadata.Any())
        //    {
        //        result = result.MergeIssue(
        //            CompositionError.CreateIssueAsWarning(CompositionErrorId.RequiredMetadataNotFound,
        //            Strings.RequiredMetadataNotFound,
        //            contractName,
        //            string.Join(", ", missingMetadata.ToArray())));

        //        return new CompositionResult(false, result.Issues);
        //    }

        //    return result;
        //}

        internal static IEnumerable <KeyValuePair <string, Type> > GetRequiredMetadata(Type metadataViewType)
        {
            if ((metadataViewType == null) ||
                ExportServices.IsDefaultMetadataViewType(metadataViewType) ||
                ExportServices.IsDictionaryConstructorViewType(metadataViewType) ||
                !metadataViewType.IsInterface)
            {
                return(Enumerable.Empty <KeyValuePair <string, Type> >());
            }

            // A metadata view is required to be an Intrerface, and therefore only properties are allowed
            List <PropertyInfo> properties = metadataViewType.GetAllProperties().
                                             Where(property => property.GetFirstAttribute <DefaultValueAttribute>() == null).
                                             ToList();

            // NOTE : this is a carefully found balance between eager and delay-evaluation - the properties are filtered once and upfront
            // whereas the key/Type pairs are created every time. The latter is fine as KVPs are structs and as such copied on access regardless.
            // This also allows us to avoid creation of List<KVP> which - at least according to FxCop - leads to isues with NGEN
            return(properties.Select(property => new KeyValuePair <string, Type>(property.Name, property.PropertyType)));
        }
예제 #16
0
        private Type CheckForLazyAndPartCreator(Type type)
        {
            if (type.IsGenericType)
            {
                Type   genericType = type.GetGenericTypeDefinition();
                Type[] arguments   = type.GetGenericArguments();

                if (genericType == LazyOfTType)
                {
                    this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], null);
                    return(arguments[0]);
                }

                if (genericType == LazyOfTMType)
                {
                    this.MetadataViewType = arguments[1];
                    this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], arguments[1]);
                    return(arguments[0]);
                }

                if (genericType == ExportFactoryOfTType || genericType == ExportFactoryOfTMType)
                {
                    this.IsPartCreator = true;
                    if (arguments.Length == 1)
                    {
                        this._castSingleValue = ExportServices.CreateStronglyTypedExportFactoryFactory(arguments[0], null);
                    }
                    else
                    {
                        Assumes.IsTrue(arguments.Length == 2);
                        this._castSingleValue = ExportServices.CreateStronglyTypedExportFactoryFactory(arguments[0], arguments[1]);
                        this.MetadataViewType = arguments[1];
                    }

                    return(arguments[0]);
                }
            }

            return(type);
        }
예제 #17
0
        private Type CheckForLazyAndPartCreator(Type type)
        {
            if (type.IsGenericType)
            {
                Type   genericType = type.GetGenericTypeDefinition();
                Type[] arguments   = type.GetGenericArguments();

                if (genericType == LazyOfTType)
                {
                    this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], null);
                    return(arguments[0]);
                }

                if (genericType == LazyOfTMType)
                {
                    this.MetadataViewType = arguments[1];
                    this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], arguments[1]);
                    return(arguments[0]);
                }

#if SILVERLIGHT
                if (genericType == PartCreatorOfTType)
                {
                    this.IsPartCreator    = true;
                    this._castSingleValue = ExportServices.CreateStronglyTypedPartCreatorFactory(arguments[0], null);
                    return(arguments[0]);
                }

                if (genericType == PartCreatorOfTMType)
                {
                    this.IsPartCreator    = true;
                    this._castSingleValue = ExportServices.CreateStronglyTypedPartCreatorFactory(arguments[0], arguments[1]);
                    this.MetadataViewType = arguments[1];
                    return(arguments[0]);
                }
#endif
            }

            return(type);
        }
        private static void EnsureCardinality(ImportDefinition definition, Export[] exports)
        {
            Requires.NullOrNotNullElements(exports, nameof(exports));

            ExportCardinalityCheckResult result = ExportServices.CheckCardinality(definition, exports);

            switch (result)
            {
            case ExportCardinalityCheckResult.NoExports:
                throw new ArgumentException(SR.Argument_ExportsEmpty, nameof(exports));

            case ExportCardinalityCheckResult.TooManyExports:
                throw new ArgumentException(SR.Argument_ExportsTooMany, nameof(exports));

            default:
                if (result != ExportCardinalityCheckResult.Match)
                {
                    throw new Exception(SR.Diagnostic_InternalExceptionMessage);
                }
                break;
            }
        }
예제 #19
0
파일: Program.cs 프로젝트: asozyurt/Tests
        private static void StatusCheck(object state)
        {
            Console.WriteLine("Status Check Started");

            var createdUsers = ImaginaryUserServices.GetUsersByStatus(UserStatus.AccountCreated);

            if (!createdUsers.IsError && ((List <ImaginaryUserDto>)createdUsers.Result).Count > Constants.EXPORT_THRESHOLD_COUNT)
            {
                Console.WriteLine("Record Count Exceed " + Constants.EXPORT_THRESHOLD_COUNT);

                // Write records to file
                var fileName = ExportServices.WriteToFile((List <ImaginaryUserDto>)createdUsers.Result);
                // Update as Exported
                ImaginaryUserServices.BulkUpdateUserStatus((List <ImaginaryUserDto>)createdUsers.Result, UserStatus.Exported);
                // Send as Mail Attachement
                NotifyServices.SendMailWithAttachement(fileName);
                // Export to Ftp
                ExportServices.ExportToFtp(fileName);
                // Finally DeleteFile
                ExportServices.DeleteFile(fileName);
            }
        }
예제 #20
0
        //protected void onSubmitBtnCommand(object source, CommandEventArgs e)
        //{
        //    Response.Clear();
        //    Response.BufferOutput = false;
        //    Response.ContentType = "text/xml";

        //    string compressionType = GetClientCompression();

        //    System.Action completeResponse =
        //        () =>
        //        {
        //            using (XmlWriter xmlWriter = XmlWriter.Create(Response.Output))
        //            {
        //                try
        //                {
        //                    Export(xmlWriter);
        //                }
        //                catch (Exception ex)
        //                {
        //                    ExceptionHandler.Publish(ex);
        //                }
        //            }
        //        };

        //    try
        //    {
        //        if (compressionType == null)
        //        {
        //            Response.ContentEncoding = Encoding.UTF8;
        //            completeResponse();
        //        }
        //        else
        //        {
        //            System.Action<Stream> compressResponse =
        //                (stream) =>
        //                {
        //                    // Response.Filter = stream;
        //                    Response.AppendHeader("Content-Encoding", compressionType);
        //                    completeResponse();
        //                };

        //            if (compressionType == "deflate")
        //            {
        //                using (DeflateStream deflateStream =
        //                    new DeflateStream(Response.Filter, CompressionMode.Compress, true))
        //                {
        //                    compressResponse(deflateStream);
        //                }
        //            }
        //            else
        //            {
        //                using (GZipStream gzStream =
        //                    new GZipStream(Response.Filter, CompressionMode.Compress, true))
        //                {
        //                    compressResponse(gzStream);
        //                }
        //            }
        //        }
        //    }
        //    finally
        //    {
        //        Response.End();
        //    }
        //}

        //protected override void Render(HtmlTextWriter writer)
        //{
        //    if (!skipRender)
        //        base.Render(writer);
        //}

        private void Export(XmlWriter writer)
        {
            ExportServices es = new ExportServices();

            es.ExceptionHandler = ExceptionHandler.Publish;
            es.DatasetSql       = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
            es.DiseaseType      = Request.Form["diseaseRadio"];
            es.PrivacyLevel     = Request.Form["privacyRadio"];

            DateTime approvalDate;

            if (DateTime.TryParse(Request.Form["approvalDate"], out approvalDate))
            {
                es.IrbApprovalDate = approvalDate;
            }

            es.IrbApprovalType = Request.Form["approvalTypeRadio"];
            es.Purpose         = Request.Form["purposeRadio"];
            es.UserLoginId     = (int)Session[SessionKey.LoginId];

            es.AppendFilenameHeaderCallback = AppendFilenameHeader;

            es.Export(writer, GetSelectedTables());
        }
예제 #21
0
 public void SetUp()
 {
     _exportManagerMock = new DynamicMock(typeof(ExportManager));
     _exportServices    = new ExportServices((ExportManager)_exportManagerMock.MockInstance);
 }
예제 #22
0
 public SpecificLazyType(Type elementType, Type metadataViewType)
 {
     this.ElementType      = elementType ?? ExportServices.DefaultExportedValueType;
     this.MetadataViewType = metadataViewType;
     this.CreateExport     = ExportServices.CreateStronglyTypedExportFactory(this.ElementType, this.MetadataViewType);
 }
예제 #23
0
 public ExportController()
 {
     clientServices    = new ClientServices();
     exportServices    = new ExportServices();
     reportingServices = new ReportingServices();
 }
        private Lazy <T, TMetadataView> GetExportCore <T, TMetadataView>(string contractName)
        {
            Export export = this.GetExportsCore(typeof(T), typeof(TMetadataView), contractName, ImportCardinality.ExactlyOne).SingleOrDefault();

            return((export != null) ? ExportServices.CreateStronglyTypedLazyOfTM <T, TMetadataView>(export) : null);
        }
예제 #25
0
        private Lazy <T> GetExportCore <T>(string contractName)
        {
            Export export = GetExportsCore(typeof(T), null, contractName, ImportCardinality.ExactlyOne).SingleOrDefault();

            return((export != null) ? ExportServices.CreateStronglyTypedLazyOfT <T>(export) : null);
        }