---
title: "Entity Framework in an Dynamics Nav (Navision) environment (or using EF to access tables with unknown table names)"
url: https://daily.dev/posts/entity-framework-in-an-dynamics-nav-navision-environment-or-using-ef-to-access-tables-with-unknow-yxhtjpkqg
source_url: https://nodogmablog.bryanhogan.net/2013/08/entity-framework-in-an-dynamics-nav-navision-environment-or-using-ef-to-access-tables-with-unknown-table-names
type: article
source: "No Dogma Blog (Bryan Hogan)"
published: 2026-05-31T07:46:41.185Z
updated: 2026-05-31T08:58:29.106Z
tags: [".net", "c#"]
reading_time: 5
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Entity Framework in an Dynamics Nav (Navision) environment (or using EF to access tables with unknown table names)

**[No Dogma Blog \(Bryan Hogan\)](https://daily.dev/sources/bryanhogan)** · 5 min read · 0 upvotes · 0 comments

## Summary

When working with Microsoft Dynamics Nav (Navision), each company has its own set of database tables prefixed with the company name (e.g., ACME$Customer), which breaks standard Entity Framework usage. After exploring failed approaches — passing a table prefix to DbContext and using DbCompiledModel — the author settled on a solution using dynamic C# code compilation at runtime. A CommonDBContext abstract class holds DbSets and model mappings, while a DynamicContext class dynamically compiles a concrete subclass per company and caches the result, avoiding repeated compilation overhead. This allows EF to target company-specific tables without requiring recompilation or redeployment when new companies are added.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nodogmablog.bryanhogan.net/2013/08/entity-framework-in-an-dynamics-nav-navision-environment-or-using-ef-to-access-tables-with-unknown-table-names>

---

Tags: [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#)

[View this post on daily.dev](https://daily.dev/posts/entity-framework-in-an-dynamics-nav-navision-environment-or-using-ef-to-access-tables-with-unknow-yxhtjpkqg)
