コード例 #1
0
ファイル: Assembly.cs プロジェクト: yglcode/jsii
 public Assembly
 (
     string name,
     string description,
     string homepage,
     AssemblyRepository repository,
     Person author,
     string fingerprint,
     string version,
     string license,
     AssemblyTargets?targets = null,
     IDictionary <string, PackageVersion>?dependencies = null,
     Person[]?contributors = null,
     IDictionary <string, string>?bundled = null,
     IDictionary <string, Type>?types     = null,
     Docs?docs     = null,
     Readme?readme = null
 ) : base(targets, dependencies)
 {
     Name         = name ?? throw new ArgumentNullException(nameof(name));
     Description  = description ?? throw new ArgumentNullException(nameof(description));
     Homepage     = homepage ?? throw new ArgumentNullException(nameof(homepage));
     Repository   = repository ?? throw new ArgumentNullException(nameof(repository));
     Author       = author ?? throw new ArgumentNullException(nameof(author));
     Fingerprint  = fingerprint ?? throw new ArgumentNullException(nameof(fingerprint));
     Version      = version ?? throw new ArgumentNullException(nameof(version));
     License      = license ?? throw new ArgumentNullException(nameof(license));
     Contributors = contributors;
     Bundled      = bundled;
     Types        = types;
     Docs         = docs;
     Readme       = readme;
 }
コード例 #2
0
 public AssemblyService(ComputerShopContext context)
 {
     categoryRepo            = new CategoryRepository(context);
     productRepo             = new ProductRepository(context);
     assemblyRepo            = new AssemblyRepository(context);
     featureRepo             = new FeatureRepository(context);
     featuresForCategoryRepo = new FeaturesForCategoryRepository(context);
     featureValueRepo        = new FeatureValueRepository(context);
     userRepo = new UserRepository(context);
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: btungut/Tungut.Solver
        static void Main(string[] args)
        {
            ISolverContainer container = new SolverContainer();

            #region Register Example 1
            //IComponent comp = Component.New(container).For<BaseFoo>().LifestyleTransient().Register();

            //container.Register(
            //    Component.New(container, Lifestyle.Transient).FromInterface<IFooContext>().ToClass<FooContext>(),
            //    Component.New(container, Lifestyle.Transient).FromInterface<IFooRepository>().ToClass<FooRepository>(),
            //    Component.New(container, Lifestyle.Transient).FromInterface<IFooManager>().ToClass<FooManager>(),
            //    Component.New(container, Lifestyle.Transient).FromInterface<IFooUserInterface>().ToClass<FooUserInterface>()
            //    );

            //var baseFoo = container.Resolve<BaseFoo>();
            //var fooContext = container.Resolve<IFooContext>();
            //var fooRepository = container.Resolve<IFooRepository>();
            //var fooManager = container.Resolve<IFooManager>();
            //var fooUserInterface = container.Resolve<IFooUserInterface>();

            //fooUserInterface.ShowData();
            #endregion

            #region Register Example 2
            var look = Stopwatch.StartNew();

            //Load all assemblies in Tungut.Business project
            IAssemblyRepository repo = new AssemblyRepository(AppDomain.CurrentDomain.BaseDirectory.Replace(".Console", ".Business"), true);
            repo.AddFilter(q => !q.FullName.Contains("BContract"));
            repo.LoadTypes();

            container.RegisterMulti(
                repo.AllTypesImplementedBy(typeof(IBigRepository<>), container, Lifestyle.Singleton),
                repo.AllTypesImplementedBy<IZooContext>(container, Lifestyle.Singleton),
                repo.AllTypesImplementedBy<IZooRepository>(container, Lifestyle.Singleton),
                repo.AllTypesImplementedBy<IZooManager>(container, Lifestyle.Singleton),
                repo.AllTypesImplementedBy<IZooUserInterface>(container, Lifestyle.Transient)
                );

            var zooUI = container.Resolve<IZooUserInterface>();
            zooUI.ShowData();

            System.Console.WriteLine(look.ElapsedMilliseconds);
            #endregion
        }
コード例 #4
0
 public LoadFromArchiveTest()
 {
     _sut = new AssemblyRepository();
 }