public AdminPanelController() { _context = new ApplicationDbContext(); _manufacturerRepository = new ManufacturerRepository(_context); _typeRepository = new TypeRepository(_context); _goodRepository = new GoodRepository(_context); }
public override BaseRepository <TypeEntity, Topic> CreateRepository() { IMMRequestContext IMMRequestContext = ContextFactory.GetNewContext(); TypeRepository TypeRepo = new TypeRepository(IMMRequestContext); return(TypeRepo); }
internal async Task <HandlerCall[]> FindCalls(JasperOptionsBuilder registry) { if (_conventionalDiscoveryDisabled) { return(_explicitTypes.SelectMany(actionsFromType).ToArray()); } if (registry.ApplicationAssembly == null) { return(new HandlerCall[0]); } // TODO -- need to expose the module assemblies off of this var types = await TypeRepository.FindTypes(registry.ApplicationAssembly, TypeClassification.Concretes | TypeClassification.Closed, type => _typeFilters.Matches(type)) .ConfigureAwait(false); return(types .Where(x => !x.HasAttribute <JasperIgnoreAttribute>()) .Concat(_explicitTypes) .Distinct() .SelectMany(actionsFromType).ToArray()); }
public EntitiesContext() { Namespaces = new NamespaceRepository(); Types = new TypeRepository(); Classes = new ClassRepository(); Enums = new EnumRepository(); }
public ActionResult TypeChart() { TypeChartViewModel typeChart = new TypeChartViewModel(); //get all TypeMatchups TypeRepository allTypes = new TypeRepository(TypeRepository.GetAllTypes()); typeChart.TypeMatchups = new Dictionary <String, Dictionary <String, Double> >(); foreach (var matchup in allTypes.GetTypeMatchups()) { //add key if doesn't exist if (!typeChart.TypeMatchups.ContainsKey(matchup.AttackingType)) { typeChart.TypeMatchups.Add(matchup.AttackingType, new Dictionary <String, Double>()); } //add matchup typeChart.TypeMatchups[matchup.AttackingType].Add(matchup.DefendingType, matchup.Modifier); } //Get all types as String typeChart.allTypes = new List <string>(); foreach (Models.PKM.Type type in TypeRepository.GetAllTypes()) { typeChart.allTypes.Add(type.Name); } ViewBag.TypeChart = typeChart; return(View("TypeChart")); }
public TransactionBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; tsRep = new TransactionRepository(unitOfWork); accRep = new AccountRepository(unitOfWork); tRep = new TypeRepository(unitOfWork); }
public DefaultRegistry() { try { Scan(scanner => { scanner.Assembly("OpenCBS.GUI"); scanner.TheCallingAssembly(); scanner.WithDefaultConventions(); scanner.ConnectImplementationsToTypesClosing(typeof(ICommand <>)); scanner.AssembliesFromPath("Extensions"); scanner.LookForRegistries(); scanner.AddAllTypesOf <IMainView>(); }); } catch (System.Exception) { Scan(scanner => { scanner.Assembly("OpenCBS.GUI"); scanner.TheCallingAssembly(); scanner.WithDefaultConventions(); scanner.ConnectImplementationsToTypesClosing(typeof(ICommand <>)); scanner.LookForRegistries(); scanner.AddAllTypesOf <IMainView>(); }); } For <ITranslationService>().Singleton().Use <TranslationService>(); For <IApplicationController>().Singleton().Use <ApplicationController>(); For <ITinyMessengerHub>().Singleton().Use <TinyMessengerHub>(); For <IConnectionProvider>().Singleton().Use <ConnectionProvider>(); TypeRepository.AssertNoTypeScanningFailures(); }
public TypeLogic CreateLogic() { var Repository = new TypeRepository(Context); var Logic = new TypeLogic(Repository); return(Logic); }
Task <ActionCall[]> IActionSource.FindActions(Assembly applicationAssembly) { var assemblies = _applies.Assemblies.Any() ? _applies.Assemblies : new Assembly[] { applicationAssembly }; return(TypeRepository.FindTypes(assemblies, TypeClassification.Concretes, _typeFilters.Matches) .ContinueWith(x => x.Result.SelectMany(actionsFromType).ToArray())); }
public void find_type_set() { var widget1 = typeof(IWidget).Assembly; var widget2 = typeof(StructureMap.Testing.Widget2.Rule1).Assembly; var widget3 = typeof(StructureMap.Testing.Widget3.ColorService).Assembly; var task = TypeRepository.FindTypes(new[] { widget1, widget2, widget3 }, type => type.Name.Contains("Color")); task.Wait(); var types = task.Result; /* * ColorRule * ColorService * ColorWidget * ColorWidgetMaker * IColor * Widget1Color * Widget2Color */ types.AllTypes().OrderBy(x => x.Name).Select(x => x.Name) .ShouldHaveTheSameElementsAs("ColorRule", "ColorService", "ColorWidget", "ColorWidgetMaker", "IColor", "Widget1Color", "Widget2Color"); types.FindTypes(TypeClassification.Interfaces).OrderBy(x => x.Name) .ShouldHaveTheSameElementsAs(typeof(IColor)); }
internal async Task <HandlerCall[]> FindCalls(JasperOptions options) { if (_conventionalDiscoveryDisabled) { return(_explicitTypes.SelectMany(actionsFromType).ToArray()); } if (options.ApplicationAssembly == null) { return(new HandlerCall[0]); } _assemblies.Add(options.ApplicationAssembly); var types = await TypeRepository.FindTypes(_assemblies, TypeClassification.Concretes | TypeClassification.Closed, type => _typeFilters.Matches(type)) .ConfigureAwait(false); return(types .Where(x => !x.HasAttribute <JasperIgnoreAttribute>()) .Concat(_explicitTypes) .Distinct() .SelectMany(actionsFromType).ToArray()); }
public async Task <ActionResult> Get(string id1, string id2, string id3, string id4, string id5, int size, string ext) { var md5 = string.Concat(id1, id2, id3, id4, id5); var image = await ImageRepository.FindByMd5AndSizeAsync(new Guid(md5), size); if (image == null && size != 0) { image = await ImageRepository.FindByMd5AndSizeAsync(new Guid(md5), 0); } if (image == null) { return(NotFound()); } var type = await TypeRepository.FindByIdAsync(image.Type); var fileName = id5; if (size != 0) { fileName += $"_{size}"; } fileName += $".{type.Ext}"; return(File(image.Data, type.Mime, fileName)); }
public BE.Type GetTypeByUrl(string url) { List<QueryParameter> parameters = new List<QueryParameter>(); parameters.Add(new QueryParameter("url", url)); List<BE.Type> types = new TypeRepository().GetByParameter("getByUrl", parameters); return types.Count > 0 ? types[0] : null; }
protected void Page_Load(object sender, EventArgs e) { Repeater1.DataSource = FilmRepository.GetAllFilms(); Repeater1.DataBind(); if (!IsPostBack) { ddlType.DataSource = TypeRepository.GetAllTypes(); ddlType.DataTextField = "TypeName"; ddlType.DataValueField = "TypeID"; ddlType.DataBind(); ddlDirector.DataSource = DirectorRepository.GetAllDirectors(); ddlDirector.DataTextField = "DirectorName"; ddlDirector.DataValueField = "DirectorID"; ddlDirector.DataBind(); ddlType.Items.Add("Hepsi"); ddlType.SelectedIndex = ddlType.Items.Count - 1; ddlDirector.Items.Add("Hepsi"); ddlDirector.SelectedIndex = ddlDirector.Items.Count - 1; } if (Request.QueryString["filmID"] != null) { FilmRepository.DeleteFilm(int.Parse(Request.QueryString["filmID"])); } if (Request.QueryString["directorID"] != null) { ddlDirector.SelectedValue = Request.QueryString["directorID"]; ddlDirector_SelectedIndexChanged(sender, e); ddlDirector.Enabled = false; return; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlDirector.DataSource = DirectorRepository.GetAllDirectors(); ddlDirector.DataTextField = "DirectorName"; ddlDirector.DataValueField = "DirectorID"; ddlDirector.DataBind(); ddlTypes.DataSource = TypeRepository.GetAllTypes(); ddlTypes.DataTextField = "TypeName"; ddlTypes.DataValueField = "TypeID"; ddlTypes.DataBind(); if (Request.QueryString["ID"] != null) { Film _film = FilmRepository.GetFilm(int.Parse(Request.QueryString["ID"])); txtFilmDescription.Text = _film.Description; ddlDirector.SelectedValue = _film.DirectorID.ToString(); ddlTypes.SelectedValue = _film.TypeID.ToString(); txtFilmName.Text = _film.FilmName; calender1.VisibleDate = _film.PublishDate; calender1.SelectedDate = _film.PublishDate.Date; btnKaydet.Text = "Güncelle"; } } }
public void BuildProductivities_IntegrationTest() { var service = GetFakeRaportService(); var sheetTable = ExcelImporter.GetSheetTable("test.xlsx".AppendAssemblyPath("Contexts\\IntegrationTests")); TypeRepository.TryGetPropertyMap(sheetTable, typeof(TestImportModel), out var propertyMap); var visitor = new TestImportModelVisitor(_operations); var actions = ExcelImporter.GetDataFromTable(sheetTable, propertyMap, new ImportModelConverter <TestImportModel, EmployeeActionBase>(visitor)); var shortBreaks = new ShortBreakSchedule { Duration = TimeSpan.FromMinutes(10), FirstBreakTime = new TimeSpan(9, 55, 0), Periodicity = TimeSpan.FromHours(2) }; var shift = new Shift { Lunch = TimeSpan.FromMinutes(30), }; var productivities = service.Build(actions, shortBreaks, shift); var employeeProductivity = new EmployeeProductivity(new Employee(), productivities); var totalTime = employeeProductivity.GetTotalWorkHours(); Assert.That(totalTime, Is.GreaterThan(5.7)); var pause = employeeProductivity.DowntimePeriods.Sum(d => d.Duration.TotalSeconds); Assert.That(pause, Is.GreaterThan(16000)); }
public void SetUp() { _dbContextOptions = new DbContextOptionsBuilder <DueltankDbContext>() .UseInMemoryDatabase("dueltank") .Options; _sut = new TypeRepository(new DueltankDbContext(_dbContextOptions)); }
public IEnumerable <Type> Find() { var assemblies = AssemblyFinder.FindDependentAssemblies().ToArray(); return (TypeRepository.FindTypes(assemblies, TypeClassification.Concretes, x => x.IsConcreteTypeOf <FubuRegistry>() && x.IsConcreteWithDefaultCtor()).Result()); }
private static ITypeRepository GetTypeRepository() { var repo = new TypeRepository(); repo.Fill(); return(repo); }
public void GetByQualifiedName_ForTypeInDefaultNamespace() { sut = new TypeRepository(RuntimeTypeSource, new TypeFactoryDummy(), new TypeFeatureProviderDummy()); var xamlType = sut.GetByQualifiedName("DummyClass"); Assert.Equal(xamlType.UnderlyingType, typeof(DummyClass)); }
public int Save(BE.Type type) { TypeRepository repository = new TypeRepository(); if(type.ID > 0) return repository.Update(type); else return repository.Insert(type); }
public void assert_no_type_scanning_failures_happy_path() { TypeRepository.ClearAll(); TypeRepository.FindTypes(GetType().GetAssembly(), TypeClassification.All).Wait(); #region sample_assert-no-type-scanning-failures TypeRepository.AssertNoTypeScanningFailures(); #endregion }
} // constructor public void AddArgument(SafeReader sr, TypeRepository oTypeRepo) { long nArgID = sr["ArgumentID"]; if (nArgID > 0) { m_oArguments.Add(new JobArgument(sr, oTypeRepo)); } } // AddArgument
private void checkStatusDB_Click(object sender, EventArgs e) //Polaczenie z baza danych { ProductRepository us = new ProductRepository(); TypeRepository tp = new TypeRepository(); us.getAllProducts(); Console.WriteLine(); tp.getAllTypes(); }
protected void btnKaydet_Click(object sender, EventArgs e) { Entity.Model.Type _type = new Entity.Model.Type() { TypeName = txtTypeName.Text, }; TypeRepository.AddType(_type); Response.Redirect("FilmList.aspx"); }
public Task <BehaviorChain[]> BuildChains(BehaviorGraph graph, IPerfTimer timer) { var types = TypeRepository.FindTypes(graph.AllAssemblies(), TypeClassification.Concretes, type => type.CanBeCastTo <Topic>()); return (types.ContinueWith( t => { return t.Result.Select(x => new SseTopicChain(x).As <BehaviorChain>()).ToArray(); })); }
public void LookForFeatures() { _types = TypeRepository .FindTypes( GetType().Assembly, TypeClassification.Concretes | TypeClassification.Closed, x => x.CanBeCastTo <IFeatureSettings>() ); }
public void assert_no_type_scanning_failures_happy_path() { TypeRepository.ClearAll(); TypeRepository.FindTypes(GetType().GetTypeInfo().Assembly, TypeClassification.All).Wait(); // SAMPLE: assert-no-type-scanning-failures TypeRepository.AssertNoTypeScanningFailures(); // ENDSAMPLE }
public void TypeRepository_mechanics() { var task = TypeRepository.FindTypes(GetType().Assembly, TypeClassification.Interfaces); task.Wait(); task.Result.ShouldContain(typeof(Interface1)); task.Result.ShouldContain(typeof(Interface2)); task.Result.ShouldNotContain(typeof(Concrete1)); }
public void Initialize() { this.db = new RedisDatabase(); var typeRepo = new TypeRepository(new TypeMetadataGenerator(false)); this.dbRecordBuilder = new DbRecordBuilder(typeRepo); this.stub = new DynamicProxyStub(typeRepo, this.db, this.dbRecordBuilder); }
public void Start() { if (!Conventions.Any()) { throw new InvalidOperationException($"There are no {nameof(IRegistrationConvention)}'s in this scanning operation. "); } _typeFinder = TypeRepository.FindTypes(_assemblies, type => _filter.Matches(type)); }
public static Task Compile(BehaviorGraph graph, IPerfTimer timer, FubuRegistry registry) { return(TypeRepository.FindTypes(graph.AllAssemblies(), TypeClassification.Concretes | TypeClassification.Closed, IsValidationRegistration) .ContinueWith(t => { t.Result.Distinct() .Each(type => registry.Services.For(typeof(IValidationRegistration)).Add(type)); })); }
public TypeRepositoryTests() { nsRegistryMock = new Mock<INamespaceRegistry>(); var type = typeof(DummyClass); var fullyConfiguredMapping = XamlNamespace .Map("root") .With(new[] {Route.Assembly(type.Assembly).WithNamespaces(new[] {type.Namespace})}); nsRegistryMock.Setup(registry => registry.GetNamespace("root")) .Returns(fullyConfiguredMapping); nsRegistryMock.Setup(registry => registry.GetNamespace("clr-namespace:DummyNamespace;Assembly=DummyAssembly")) .Returns(new ClrNamespace(type.Assembly, type.Namespace)); sut = new TypeRepository(nsRegistryMock.Object, new TypeFactoryDummy(), new TypeFeatureProviderDummy()); }
public void Initialize() { sut = new TypeRepository(nsRegistryMock.Object, new TypeFactoryDummy(), new TypeFeatureProviderDummy()); }
public static IRuntimeTypeSource FromAttributes(IEnumerable<Assembly> assemblies) { var allExportedTypes = assemblies.AllExportedTypes(); var typeFactory = new TypeFactory(); var xamlNamespaceRegistry = new NamespaceRegistry(); xamlNamespaceRegistry.FillFromAttributes(assemblies); var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider()); typeFeatureProvider.FillFromAttributes(allExportedTypes); var xamlTypeRepo = new TypeRepository(xamlNamespaceRegistry, typeFactory, typeFeatureProvider); return new RuntimeTypeSource(xamlTypeRepo, xamlNamespaceRegistry); }
private static IRuntimeTypeSource CreateRuntimeTypeSource() { var typeFactory = new MultiFactory( new List<TypeFactoryRegistration> { new TypeFactoryRegistration(new TypeFactory(), type => type != typeof (ChildClass)), new TypeFactoryRegistration(new TypeFactoryMock((type, args) => new ChildClass {Name = "InnerName"}), type => type == typeof (ChildClass)), }); var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider()); var xamlTypeRepository = new TypeRepository(new NamespaceRegistry(), typeFactory, typeFeatureProvider); var typeSource = new RuntimeTypeSource(xamlTypeRepository, new NamespaceRegistry()); typeFeatureProvider.RegisterMetadata(typeof (DummyObject), new Metadata {RuntimePropertyName = "Name"}); return typeSource; }