{"id":374,"date":"2019-12-31T22:15:00","date_gmt":"2019-12-31T09:15:00","guid":{"rendered":"https:\/\/blog.wiseowls.co.nz\/?p=374"},"modified":"2026-03-08T00:44:43","modified_gmt":"2026-03-07T11:44:43","slug":"ef-core-3-find-primary-key-dynamic","status":"publish","type":"post","link":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/","title":{"rendered":"EF Core 3: Getting model metadata from dynamically loaded  assembly with IL Emit"},"content":{"rendered":"\n<p>Yet another <a href=\"https:\/\/stackoverflow.com\/q\/59529311\/12339804\">Stack Overflow question<\/a> has sparked a heated discussion and got us thinking whether we can do better.<\/p>\n\n\n\n<p>In a nutshell, the question was about finding a way to query EF Core model metadata without directly referencing the assembly that defines it. Think MsBuild Task that needs to check if your model is following your company standards. Or a test of some sort. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">First stab at it<\/h2>\n\n\n\n<p>We were able to help the OP by quickly whipping up the following loader code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">var assembly = Assembly.LoadFrom(@\"C:\\OnlineShoppingStore\\bin\\Debug\\netcoreapp2.2\\OnlineShoppingStore.dll\");\nvar contextType = assembly.GetTypes().First(d => d.Name == \"OnlineStoreDbContext\");\nvar ctx = Activator.CreateInstance(contextType) as DbContext; \/\/ instantiate your context. this will effectively build your model, so you must have all required EF references in your project\nvar p = ctx.Model.FindEntityType(assembly.GetTypes().First(d => d.Name == \"Product\")); \/\/ get the type from loaded assembly\n\/\/var p = ctx.Model.FindEntityType(\"OnlineStoreDbContext.Product\"); \/\/ querying model by type name also works, but you'd need to correctly qualify your type names\nvar pk = p.FindPrimaryKey().Properties.First().Name; \/\/ your PK property name as built by EF model<\/code><\/pre>\n\n\n\n<p>The answer ended up being accepted, but the OP had a bit of an issue with instantiating the Context:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">System.InvalidOperationException: 'No database provider has been configured for this DbContext. \nA provider can be configured by overriding the DbContext.OnConfiguring method or by using AddDbContext on the application service provider. \nIf AddDbContext is used, then also ensure that your DbContext type accepts a DbContextOptions<tcontext> object in its constructor and passes it to the base constructor for DbContext.<\/tcontext><\/pre>\n\n\n\n<p>This is kind of expected: when EF creates the context it will invoke <code>OnConfiguring<\/code> override and set up DB provider with connection strings and so on and so forth.  It all is necessary for the actual thing to run, but for the OP it meant having to drag all DB providers into the test harness. Not ideal.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The idea<\/h2>\n\n\n\n<p>After a bit back and forth I&#8217;ve got an idea. What if we subclass the <code>Context<\/code> yet again and override the <code>OnConfiguring <\/code>with a predefined Provider (say, <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/providers\/in-memory\/?tabs=dotnet-core-cli\">InMemory<\/a>)?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">IL Emit all things<\/h2>\n\n\n\n<p>We don&#8217;t get to use <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.reflection.emit?view=netframework-4.8\">IL Emit<\/a> often &#8211; it&#8217;s meant for pretty specific use cases and I think this is one. The key to getting it right in our case was finding the correct overload of <code>UseInMemoryDatabase<\/code>. There&#8217;s a chance however, that you might need to tweak it to suit your needs. It is pretty trivial once you know what you&#8217;re looking for.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">public static MethodBuilder OverrideOnConfiguring(this TypeBuilder tb)\n        {\n            MethodBuilder onConfiguringMethod = tb.DefineMethod(\"OnConfiguring\",\n                MethodAttributes.Public\n                | MethodAttributes.HideBySig\n                | MethodAttributes.NewSlot\n                | MethodAttributes.Virtual,\n                CallingConventions.HasThis,\n                null,\n                new[] { typeof(DbContextOptionsBuilder) });\n\n            \/\/ the easiest method to pick will be .UseInMemoryDatabase(this DbContextOptionsBuilder optionsBuilder, string databaseName, Action&lt;InMemoryDbContextOptionsBuilder> inMemoryOptionsAction = null)\n            \/\/ but since constructing generic delegate seems a bit too much effort we'd rather filter everything else out\n            var useInMemoryDatabaseMethodSignature = typeof(InMemoryDbContextOptionsExtensions)\n                .GetMethods()\n                .Where(m => m.Name == \"UseInMemoryDatabase\")\n                .Where(m => m.GetParameters().Length == 3)\n                .Where(m => m.GetParameters().Select(p => p.ParameterType).Contains(typeof(DbContextOptionsBuilder)))\n                .Where(m => m.GetParameters().Select(p => p.ParameterType).Contains(typeof(string)))\n                .Single();\n            \n            \/\/ emits the equivalent of optionsBuilder.UseInMemoryDatabase(\"test\");\n            var gen = onConfiguringMethod.GetILGenerator();\n            gen.Emit(OpCodes.Ldarg_1);\n            gen.Emit(OpCodes.Ldstr, Guid.NewGuid().ToString());\n            gen.Emit(OpCodes.Ldnull);\n            gen.Emit(OpCodes.Call, useInMemoryDatabaseMethodSignature);\n            gen.Emit(OpCodes.Pop);\n            gen.Emit(OpCodes.Ret);\n\n            return onConfiguringMethod;\n        }<\/code><\/pre>\n\n\n\n<p>with the above out of the way we now can build our dynamic type and plug it into our test harness!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">class Program\n    {\n        static void Main(string[] args)\n        {\n            \/\/ load assembly under test\n            var assembly = Assembly.LoadFrom(@\"..\\ef-metadata-query\\OnlineShoppingStore\\bin\\Debug\\netcoreapp3.1\\OnlineShoppingStore.dll\");\n            var contextType = assembly.GetTypes().First(d => d.Name == \"OnlineStoreDbContext\");\n\n            \/\/ create yet another assembly that will hold our dynamically generated type\n            var typeBuilder = AssemblyBuilder\n                                .DefineDynamicAssembly(new AssemblyName(Guid.NewGuid().ToString()), AssemblyBuilderAccess.RunAndCollect)\n                                .DefineDynamicModule(Guid.NewGuid() + \".dll\")\n                                .DefineType(\"InheritedDbContext\", TypeAttributes.Public, contextType); \/\/ make new type inherit from DbContext under test!\n\n            \/\/ this is the key here! now our dummy implementation will kick in!\n            var onConfiguringMethod = typeBuilder.OverrideOnConfiguring();\n            typeBuilder.DefineMethodOverride(onConfiguringMethod, typeof(DbContext).GetMethod(\"OnConfiguring\", BindingFlags.Instance | BindingFlags.NonPublic));\n            \n            var inheritedDbContext = typeBuilder.CreateType(); \/\/ enough config, let's get the type and roll with it\n\n            \/\/ instantiate inheritedDbContext with default OnConfiguring implementation\n            var context = Activator.CreateInstance(inheritedDbContext) as DbContext; \/\/ instantiate your context. this will effectively build your model, so you must have all required EF references in your project\n            var p = context?.Model.FindEntityType(assembly.GetTypes().First(d => d.Name == \"Product\")); \/\/ get the type from loaded assembly\n            \n            \/\/query the as-built model\n            \/\/var p = ctx.Model.FindEntityType(\"OnlineStoreDbContext.Product\"); \/\/ querying model by type name also works, but you'd need to correctly qualify your type names\n            var pk = p.FindPrimaryKey().Properties.First().Name; \/\/ your PK property name as built by EF model\n            \n            Console.WriteLine(pk);\n        }\n    }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">  This is runnable<\/h2>\n\n\n\n<p>Source code is available on <a href=\"https:\/\/github.com\/tkhadimullin\/ef-core-metadata-query\">GitHub<\/a> in case you want to check it out and play a bit<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yet another Stack Overflow question has sparked a heated discussion and got us thinking whether we can do better. In a nutshell, the question was about finding a way to query EF Core model metadata without directly referencing the assembly that defines it. Think MsBuild Task that needs to check if your model is following &hellip; <a href=\"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;EF Core 3: Getting model metadata from dynamically loaded  assembly with IL Emit&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":391,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[11],"tags":[12,23,59],"class_list":["post-374","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev","tag-c","tag-ef-core","tag-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit - Timur and associates<\/title>\n<meta name=\"description\" content=\"Loading EF Core model metadata from a runtime-loaded assembly using IL Emit. Think MsBuild tasks or custom tooling.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit - Timur and associates\" \/>\n<meta property=\"og:description\" content=\"Loading EF Core model metadata from a runtime-loaded assembly using IL Emit. Think MsBuild tasks or custom tooling.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/\" \/>\n<meta property=\"og:site_name\" content=\"Timur and associates\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-31T09:15:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-07T11:44:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/02\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1980\" \/>\n\t<meta property=\"og:image:height\" content=\"801\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"timur\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@TimurKh\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/\"},\"author\":{\"name\":\"timur\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#\\\/schema\\\/person\\\/34d0ed30d573b5bc317ea990bd2e0c59\"},\"headline\":\"EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit\",\"datePublished\":\"2019-12-31T09:15:00+00:00\",\"dateModified\":\"2026-03-07T11:44:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/\"},\"wordCount\":307,\"image\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg\",\"keywords\":[\"c#\",\"ef-core\",\"sql\"],\"articleSection\":[\"Development\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/\",\"url\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/\",\"name\":\"EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit - Timur and associates\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg\",\"datePublished\":\"2019-12-31T09:15:00+00:00\",\"dateModified\":\"2026-03-07T11:44:43+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#\\\/schema\\\/person\\\/34d0ed30d573b5bc317ea990bd2e0c59\"},\"description\":\"Loading EF Core model metadata from a runtime-loaded assembly using IL Emit. Think MsBuild tasks or custom tooling.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/#primaryimage\",\"url\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg\",\"contentUrl\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg\",\"width\":1980,\"height\":801},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/12\\\/31\\\/ef-core-3-find-primary-key-dynamic\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#website\",\"url\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/\",\"name\":\"Timur and associates\",\"description\":\"Notes of an IT contractor\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#\\\/schema\\\/person\\\/34d0ed30d573b5bc317ea990bd2e0c59\",\"name\":\"timur\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg\",\"caption\":\"timur\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/TimurKh\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit - Timur and associates","description":"Loading EF Core model metadata from a runtime-loaded assembly using IL Emit. Think MsBuild tasks or custom tooling.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/","og_locale":"en_US","og_type":"article","og_title":"EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit - Timur and associates","og_description":"Loading EF Core model metadata from a runtime-loaded assembly using IL Emit. Think MsBuild tasks or custom tooling.","og_url":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/","og_site_name":"Timur and associates","article_published_time":"2019-12-31T09:15:00+00:00","article_modified_time":"2026-03-07T11:44:43+00:00","og_image":[{"width":1980,"height":801,"url":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/02\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg","type":"image\/jpeg"}],"author":"timur","twitter_card":"summary_large_image","twitter_creator":"@TimurKh","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/#article","isPartOf":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/"},"author":{"name":"timur","@id":"https:\/\/blog.wiseowls.co.nz\/#\/schema\/person\/34d0ed30d573b5bc317ea990bd2e0c59"},"headline":"EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit","datePublished":"2019-12-31T09:15:00+00:00","dateModified":"2026-03-07T11:44:43+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/"},"wordCount":307,"image":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/02\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg","keywords":["c#","ef-core","sql"],"articleSection":["Development"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/","url":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/","name":"EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit - Timur and associates","isPartOf":{"@id":"https:\/\/blog.wiseowls.co.nz\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/#primaryimage"},"image":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/02\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg","datePublished":"2019-12-31T09:15:00+00:00","dateModified":"2026-03-07T11:44:43+00:00","author":{"@id":"https:\/\/blog.wiseowls.co.nz\/#\/schema\/person\/34d0ed30d573b5bc317ea990bd2e0c59"},"description":"Loading EF Core model metadata from a runtime-loaded assembly using IL Emit. Think MsBuild tasks or custom tooling.","breadcrumb":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/#primaryimage","url":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/02\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg","contentUrl":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/02\/tobias-fischer-PkbZahEG2Ng-unsplash-scaled-e1582017537106.jpg","width":1980,"height":801},{"@type":"BreadcrumbList","@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/12\/31\/ef-core-3-find-primary-key-dynamic\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.wiseowls.co.nz\/"},{"@type":"ListItem","position":2,"name":"EF Core 3: Getting model metadata from dynamically loaded assembly with IL Emit"}]},{"@type":"WebSite","@id":"https:\/\/blog.wiseowls.co.nz\/#website","url":"https:\/\/blog.wiseowls.co.nz\/","name":"Timur and associates","description":"Notes of an IT contractor","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.wiseowls.co.nz\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.wiseowls.co.nz\/#\/schema\/person\/34d0ed30d573b5bc317ea990bd2e0c59","name":"timur","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg","caption":"timur"},"sameAs":["https:\/\/x.com\/TimurKh"]}]}},"_links":{"self":[{"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/posts\/374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/comments?post=374"}],"version-history":[{"count":6,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":630,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/posts\/374\/revisions\/630"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/media\/391"}],"wp:attachment":[{"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}