public override MaterialSet Convert(IMaterialProvider materialProvider, NULLPARAM param) { var context = new ProviderContext(10); materialProvider.Reset(context); return(materialProvider.ProvideNext(context)); }
public App() { mainWindow = new MainWindow(); mainWindow.PreviewKeyDown += MainWindow_PreviewKeyDown; dbContext = new ProviderContext(connString) { CommandFactory = new NpgsqlCommandFactory(), ConnectionFactory = new NpgsqlConnectionFactory(), }; //var users = dbContext.SelectAll<User>(); //var users = dbContext.SelectAll<Service>(); //table = mainWindow.dbGrid; //table.EntityType = typeof(Service); //table.DbContext = dbContext; //table.ItemSelector = () => dbContext.SelectAll<Service>(); InitializeDbControl(); mainWindow.Show(); }
private void CreateIPFilters(IEnumerable <string> ips, Callout callout, ProviderContext providerContext) { foreach (var ip in ips) { SafeCreateIPFilter(ip, callout, providerContext); } }
public static int MatchToProperty(Type propertyType, ProviderContext context) { if (typeof(ScriptComponent).IsAssignableFrom(propertyType) && context.ParentEditor is GameObjectOverviewPropertyEditor) return PropertyEditorAssignmentAttribute.PrioritySpecialized; return PropertyEditorAssignmentAttribute.PriorityNone; }
public void IsInMemory_when_using_in_memory() { using (var context = new ProviderContext()) { Assert.True(context.Database.IsInMemory()); } }
public PropertyEditor CreateEditor(Type baseType, ProviderContext context) { IEnumerable <Type> propertyEditorTypes = DualityEditorApp.GetAvailDualityEditorTypes(typeof(PropertyEditor)); if (propertyEditorTypes.Any()) { int bestScore = PropertyGrid.EditorPriority_None; Type bestType = null; foreach (Type editorType in propertyEditorTypes) { var assignment = editorType.GetCustomAttributes <PropertyEditorAssignmentAttribute>().FirstOrDefault(); if (assignment == null) { continue; } int score = assignment.MatchToProperty(baseType, context); if (score > bestScore) { bestScore = score; bestType = editorType; } } if (bestType != null) { return(bestType.CreateInstanceOf() as PropertyEditor); } } return(null); }
public PropertyEditor CreateEditor(Type baseType, ProviderContext context) { PropertyEditor e = null; if (baseType == typeof(Vector2)) { e = new Vector2PropertyEditor(); } else if (baseType == typeof(Vector3)) { e = new Vector3PropertyEditor(); } else if (baseType == typeof(Vector4)) { e = new Vector4PropertyEditor(); } else if (baseType == typeof(Rect)) { e = new RectPropertyEditor(); } else if (typeof(IColorData).IsAssignableFrom(baseType)) { e = new IColorDataPropertyEditor(); } return(e); }
public int IsResponsibleFor(Type baseType, ProviderContext context) { IEnumerable <Type> propertyEditorTypes = DualityEditorApp.GetAvailDualityEditorTypes(typeof(PropertyEditor)); if (propertyEditorTypes.Any()) { int bestScore = PropertyGrid.EditorPriority_None; foreach (Type editorType in propertyEditorTypes) { var assignment = editorType.GetCustomAttributes <PropertyEditorAssignmentAttribute>().FirstOrDefault(); if (assignment == null) { continue; } int score = assignment.MatchToProperty(baseType, context); if (score > bestScore) { bestScore = score; } } return(bestScore); } else { return(PropertyGrid.EditorPriority_None); } }
/// <summary> /// Creates a <see cref="PropertyEditor"/> that is able to edit objects /// of the specified base type. /// </summary> /// <param name="baseType"></param> /// <param name="context"></param> /// <returns></returns> public PropertyEditor CreateEditor(Type baseType, ProviderContext context) { if (this.propertyEditorAssignments == null) { this.RetrieveAssignments(); } int bestScore = PropertyGrid.EditorPriority_None; TypeInfo bestType = null; foreach (EditorItem item in this.propertyEditorAssignments) { int score = item.Assignment.MatchToProperty(baseType, context); if (score > bestScore) { bestScore = score; bestType = item.EditorType; } } if (bestType != null) { return(bestType.CreateInstanceOf() as PropertyEditor); } else { return(null); } }
public int IsResponsibleFor(Type baseType, ProviderContext context) { if (baseType == typeof(Vector2)) { return(PropertyGrid.EditorPriority_General); } else if (baseType == typeof(Vector3)) { return(PropertyGrid.EditorPriority_General); } else if (baseType == typeof(Vector4)) { return(PropertyGrid.EditorPriority_General); } else if (baseType == typeof(Rect)) { return(PropertyGrid.EditorPriority_General); } else if (typeof(IColorData).IsAssignableFrom(baseType)) { return(PropertyGrid.EditorPriority_General); } else { return(PropertyGrid.EditorPriority_None); } }
public async Task <IActionResult> DisplayName(DisplayName.Command command, ProviderContext providerContext) { command.ProviderId = providerContext.ProviderInfo.ProviderId; return(await _mediator.SendAndMapResponse( command, success => RedirectToAction(nameof(ProviderDetails)).WithProviderContext(providerContext))); }
private void CreateAppFilters(string[] apps, Callout callout, Layer layer, ProviderContext providerContext) { foreach (var app in apps) { SafeCreateAppFilter(app, callout, layer, providerContext); } }
public void IsNpgsql_when_using_constructor() { using var context = new ProviderContext( new DbContextOptionsBuilder().UseNpgsql("Database=Maltesers").Options); Assert.True(context.Database.IsNpgsql()); }
private void CreateIPFilters(string[] ips, Callout callout, Layer layer, ProviderContext providerContext) { foreach (var ip in ips) { SafeCreateIPFilter(ip, callout, layer, providerContext); } }
public void IsInMemory_when_using_in_memory() { using (var context = new ProviderContext()) { Assert.True(InMemoryDatabaseFacadeExtensions.IsInMemory(context.Database)); } }
public void Initialize(ServiceContext context) { this.context = context; chatFacade = new ChatFacade(context); webHandler = new WebHandler(chatFacade); providerContext = new ProviderContext(context, chatFacade); context.RestfulServer.UseRoute((RouteBuilder routeBuilder) => { routeBuilder .MapGet("client/{client}/user_id", webHandler.GetUserId) .MapGet("client/{client}/username", webHandler.GetUsername) .MapPost("chat/{client}/{channel}/send", webHandler.PostSendMessage) .MapPost("private_chat/{client}/{user}/send", webHandler.PostSendPrivateMessage) .MapPost("chat/{client}/{channel}/timeout", webHandler.TimeoutUser) .MapPost("chat/{client}/{channel}/ban", webHandler.BanUser) .MapGet("chat/{client}/{channel}/room_list", webHandler.GetRoomList) ; }); providers = new List <IProvider>(); createProviders(); }
private void CreateAppFilters(IEnumerable <string> apps, Callout callout, ProviderContext providerContext) { foreach (var app in apps) { SafeCreateAppFilter(app, callout, providerContext); } }
public void Not_IsSqlite_when_using_different_provider() { using var context = new ProviderContext( new DbContextOptionsBuilder() .UseInternalServiceProvider(InMemoryFixture.DefaultServiceProvider) .UseInMemoryDatabase("Maltesers").Options); Assert.False(context.Database.IsSqlite()); }
public void Not_IsSqlite_when_using_different_provider() { using (var context = new ProviderContext( new DbContextOptionsBuilder().UseInMemoryDatabase("Maltesers").Options)) { Assert.False(SqliteDatabaseFacadeExtensions.IsSqlite(context.Database)); } }
public void IsSqlite_when_using_SQLite() { using (var context = new ProviderContext( new DbContextOptionsBuilder().UseSqlite("Database=Maltesers").Options)) { Assert.True(SqliteDatabaseFacadeExtensions.IsSqlite(context.Database)); } }
private static int MatchToProperty(Type propertyType, ProviderContext context) { bool compRef = !(context.ParentEditor is GameObjectOverviewPropertyEditor); if (typeof(RigidBody).IsAssignableFrom(propertyType) && !compRef) return PropertyEditorAssignmentAttribute.PriorityGeneral + 1; else return PropertyEditorAssignmentAttribute.PriorityNone; }
public void Not_IsOracle_when_using_different_provider() { using (var context = new ProviderContext( new DbContextOptionsBuilder().UseInMemoryDatabase("Maltesers").Options)) { Assert.False(context.Database.IsOracle()); } }
public void IsSqlServer_when_using_constructor() { using var context = new ProviderContext( new DbContextOptionsBuilder() .UseInternalServiceProvider(SqlServerFixture.DefaultServiceProvider) .UseSqlServer("Database=Maltesers").Options); Assert.True(context.Database.IsSqlServer()); }
public void IsOracle_when_using_constructor() { using (var context = new ProviderContext( new DbContextOptionsBuilder().UseOracle("Database=Maltesers").Options)) { Assert.True(context.Database.IsOracle()); } }
/// <summary> /// Determines the matching level between a PropertyEditor and the specified property Type. /// </summary> /// <param name="propertyType"></param> /// <param name="context"></param> /// <returns></returns> public int MatchToProperty(Type propertyType, ProviderContext context) { if (this.dynamicAssign != null) return this.dynamicAssign(propertyType, context); else if (this.assignToType.IsAssignableFrom(propertyType)) return this.assignPriority; else return PropertyGrid.EditorPriority_None; }
public async Task <IActionResult> DisplayName(ProviderContext providerContext) { var query = new DisplayName.Query() { ProviderId = providerContext.ProviderInfo.ProviderId }; return(await _mediator.SendAndMapResponse(query, vm => View(vm))); }
public async Task <IActionResult> ProviderDetails(ProviderContext providerContext) { var request = new ProviderDetails.Query() { ProviderId = providerContext.ProviderInfo.ProviderId }; return(await _mediator.SendAndMapResponse(request, vm => View(vm))); }
public EditProviderTypeController( IMediator mediator, ICurrentUserProvider currentUserProvider, IProviderContextProvider providerContextProvider) { _mediator = mediator; _currentUserProvider = currentUserProvider; _providerContext = providerContextProvider.GetProviderContext(); }
public async Task <IActionResult> ApprenticeshipDetails(ProviderContext providerContext) { var query = new ApprenticeshipDetails.Query() { ProviderId = providerContext.ProviderInfo.ProviderId }; return(await _mediator.SendAndMapResponse(query, vm => View(vm))); }
public async Task <IActionResult> ApprenticeshipEmployerLocationsRegions(ProviderContext providerContext) { var query = new ApprenticeshipEmployerLocationsRegions.Query() { ProviderId = providerContext.ProviderInfo.ProviderId }; return(await _mediator.SendAndMapResponse(query, command => View(command))); }
public override object GetInstance(InjectionCore injectionCore, ProviderContext context) { if (this.singletonInstance == null) { this.singletonInstance = base.GetInstance(injectionCore, context); } return(this.singletonInstance); }
/// <summary> /// Sends the window/logMessage notification to the LSP client. /// </summary> /// <returns>A task to send the window/logMessage notification.</returns> public static Task LogMessageAsync(this ProviderContext providerContext, MessageType messageType, string message) { return(Dispatch(providerContext, "window/logMessage", new LogMessageParams() { MessageType = messageType, Message = message, })); }
/// <summary> /// Determines whether this provider is responsible for creating a <see cref="PropertyEditor"/> /// that is able to edit objects of the specified base type. /// </summary> /// <param name="baseType"></param> /// <param name="context"></param> /// <returns></returns> public int IsResponsibleFor(Type baseType, ProviderContext context) { if (this.propertyEditorAssignments == null) this.RetrieveAssignments(); int bestScore = PropertyGrid.EditorPriority_None; foreach (EditorItem item in this.propertyEditorAssignments) { int score = item.Assignment.MatchToProperty(baseType, context); if (score > bestScore) { bestScore = score; } } return bestScore; }
/// <summary> /// Creates a <see cref="PropertyEditor"/> that is able to edit objects /// of the specified base type. /// </summary> /// <param name="baseType"></param> /// <param name="context"></param> /// <returns></returns> public PropertyEditor CreateEditor(Type baseType, ProviderContext context) { if (this.propertyEditorAssignments == null) this.RetrieveAssignments(); int bestScore = PropertyGrid.EditorPriority_None; TypeInfo bestType = null; foreach (EditorItem item in this.propertyEditorAssignments) { int score = item.Assignment.MatchToProperty(baseType, context); if (score > bestScore) { bestScore = score; bestType = item.EditorType; } } if (bestType != null) return bestType.CreateInstanceOf() as PropertyEditor; else return null; }
public int IsResponsibleFor(Type baseType, ProviderContext context) { IEnumerable<Type> propertyEditorTypes = DualityEditorApp.GetAvailDualityEditorTypes(typeof(PropertyEditor)); if (propertyEditorTypes.Any()) { int bestScore = PropertyGrid.EditorPriority_None; foreach (Type editorType in propertyEditorTypes) { var assignment = editorType.GetAttributesCached<PropertyEditorAssignmentAttribute>().FirstOrDefault(); if (assignment == null) continue; int score = assignment.MatchToProperty(baseType, context); if (score > bestScore) { bestScore = score; } } return bestScore; } else { return PropertyGrid.EditorPriority_None; } }
public PropertyEditor CreateEditor(Type baseType, ProviderContext context) { IEnumerable<Type> propertyEditorTypes = DualityEditorApp.GetAvailDualityEditorTypes(typeof(PropertyEditor)); if (propertyEditorTypes.Any()) { int bestScore = PropertyGrid.EditorPriority_None; Type bestType = null; foreach (Type editorType in propertyEditorTypes) { var assignment = editorType.GetAttributesCached<PropertyEditorAssignmentAttribute>().FirstOrDefault(); if (assignment == null) continue; int score = assignment.MatchToProperty(baseType, context); if (score > bestScore) { bestScore = score; bestType = editorType; } } if (bestType != null) return bestType.CreateInstanceOf() as PropertyEditor; } return null; }
public ToolController(ProviderContext providerContext) { ProviderContext = providerContext; }
private static int MatchToProperty(Type propertyType, ProviderContext context) { if (typeof(GameObject).IsAssignableFrom(propertyType) && context.ParentEditor != null) return PropertyEditorAssignmentAttribute.PrioritySpecialized; else return PropertyEditorAssignmentAttribute.PriorityNone; }
public int IsResponsibleFor(Type baseType, ProviderContext context) { return EditorPriority_General; }
public PropertyEditor CreateEditor(Type baseType, ProviderContext context) { PropertyEditor e = null; // Basic numeric data types if (baseType == typeof(sbyte) || baseType == typeof(byte) || baseType == typeof(short) || baseType == typeof(ushort) || baseType == typeof(int) || baseType == typeof(uint) || baseType == typeof(long) || baseType == typeof(ulong) || baseType == typeof(float) || baseType == typeof(double) || baseType == typeof(decimal)) e = new NumericPropertyEditor(); // Basic data type: Boolean else if (baseType == typeof(bool)) e = new BoolPropertyEditor(); // Basic data type: Flagged Enum else if (baseType.IsEnum && baseType.GetCustomAttributes(typeof(FlagsAttribute), true).Any()) e = new FlaggedEnumPropertyEditor(); // Basic data type: Other Enums else if (baseType.IsEnum) e = new EnumPropertyEditor(); // Basic data type: String else if (baseType == typeof(string)) e = new StringPropertyEditor(); // IList else if (typeof(System.Collections.IList).IsAssignableFrom(baseType)) e = new IListPropertyEditor(); // IList else if (typeof(System.Collections.IDictionary).IsAssignableFrom(baseType)) e = new IDictionaryPropertyEditor(); // Unknown data type else { // Ask around if any sub-editor can handle it and choose the most specialized var availSubProviders = from p in this.subProviders where p.IsResponsibleFor(baseType, context) != EditorPriority_None orderby p.IsResponsibleFor(baseType, context) descending select p; IPropertyEditorProvider subProvider = availSubProviders.FirstOrDefault(); if (subProvider != null) { e = subProvider.CreateEditor(baseType, context); e.EditedType = baseType; return e; } // If not, default to reflection-driven MemberwisePropertyEditor e = new MemberwisePropertyEditor(); } e.EditedType = baseType; return e; }
private static int MatchToProperty(Type propertyType, ProviderContext context) { bool compRef = !(context.ParentEditor is GameObjectOverviewPropertyEditor); if (typeof(Component).IsAssignableFrom(propertyType) && !compRef) return PropertyEditorAssignmentAttribute.PriorityGeneral; else return PropertyEditorAssignmentAttribute.PriorityNone; }
public ConsumerController(ProviderContext providerContext) { ProviderContext = providerContext; }