{"action":"created","issue":{"url":"https://api.github.com/repos/toddams/RazorLight/issues/209","repository_url":"https://api.github.com/repos/toddams/RazorLight","labels_url":"https://api.github.com/repos/toddams/RazorLight/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/toddams/RazorLight/issues/209/comments","events_url":"https://api.github.com/repos/toddams/RazorLight/issues/209/events","html_url":"https://github.com/toddams/RazorLight/issues/209","id":346102717,"node_id":"MDU6SXNzdWUzNDYxMDI3MTc=","number":209,"title":"Multiple instancies of IRazorLightEngine","user":{"login":"reponemec","id":19886511,"node_id":"MDQ6VXNlcjE5ODg2NTEx","avatar_url":"https://avatars3.githubusercontent.com/u/19886511?v=4","gravatar_id":"","url":"https://api.github.com/users/reponemec","html_url":"https://github.com/reponemec","followers_url":"https://api.github.com/users/reponemec/followers","following_url":"https://api.github.com/users/reponemec/following{/other_user}","gists_url":"https://api.github.com/users/reponemec/gists{/gist_id}","starred_url":"https://api.github.com/users/reponemec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reponemec/subscriptions","organizations_url":"https://api.github.com/users/reponemec/orgs","repos_url":"https://api.github.com/users/reponemec/repos","events_url":"https://api.github.com/users/reponemec/events{/privacy}","received_events_url":"https://api.github.com/users/reponemec/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-31T09:17:43Z","updated_at":"2018-07-31T09:41:10Z","closed_at":null,"author_association":"NONE","body":"Is it possible to use multiple instancies of IRazorLightEngine at the same time in ASP.Net Core application? For example, first instance for embeded resource templates, second for database and third for files. Then, I need access to these engines separately using dependency injection.\r\nCurrently, I use following construct for creating engine for one of them - embeded resources:\r\n\r\n```\r\nStartup.cs:\r\n...\r\nvoid ConfigureRazorLight(IServiceCollection services)\r\n        {\r\n            RazorLightEngine engine = new RazorLightEngineBuilder()\r\n                .UseEmbeddedResourcesProject(typeof(Program))\r\n                .UseMemoryCachingProvider()\r\n                .Build();\r\n                //The next line must be used (I use RazorLight 2.0.0-beta1), otherwise application fails at IRazorLightEngine.CompileRenderAsync if I declare a custom service @inject IMyService in a razor view and try to use its instance!\r\n                services.AddRazorLight(() => engine); \r\n        }\r\n\r\n```\r\nThe problem is that this way I obtain access only for one type of templates (embeded resources).\r\n\r\nFor info, a source code for AddRazorLight extension method is [here](https://github.com/toddams/RazorLight/blob/master/src/RazorLight/Extensions/ServiceCollectionExtensions.cs)."},"comment":{"url":"https://api.github.com/repos/toddams/RazorLight/issues/comments/409160678","html_url":"https://github.com/toddams/RazorLight/issues/209#issuecomment-409160678","issue_url":"https://api.github.com/repos/toddams/RazorLight/issues/209","id":409160678,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTE2MDY3OA==","user":{"login":"szilardd","id":968502,"node_id":"MDQ6VXNlcjk2ODUwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/968502?v=4","gravatar_id":"","url":"https://api.github.com/users/szilardd","html_url":"https://github.com/szilardd","followers_url":"https://api.github.com/users/szilardd/followers","following_url":"https://api.github.com/users/szilardd/following{/other_user}","gists_url":"https://api.github.com/users/szilardd/gists{/gist_id}","starred_url":"https://api.github.com/users/szilardd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szilardd/subscriptions","organizations_url":"https://api.github.com/users/szilardd/orgs","repos_url":"https://api.github.com/users/szilardd/repos","events_url":"https://api.github.com/users/szilardd/events{/privacy}","received_events_url":"https://api.github.com/users/szilardd/received_events","type":"User","site_admin":false},"created_at":"2018-07-31T09:41:10Z","updated_at":"2018-07-31T09:41:10Z","author_association":"NONE","body":"I think this can be solved using a custom RazorLight project. Sample here: https://github.com/toddams/RazorLight/tree/dev-2.0/samples/RazorLight.Samples\r\n\r\nMaybe this will help also, this one loads templates from multiple assemblies, which is not supported by default https://github.com/toddams/RazorLight/issues/197 "}}
{"actor":{"display_login":"szilardd"}}