Back to
Latest changes:

This is an old revision of the document!

How to run through data model entities and attributes

Sometimes you need to run through all entities and attributes in your data model to perform some operation for each of them or to find a particular entity or attribute. Here is a code snippet which demonstrates this operation:

private void RunThroughEntity(Entity entity) {
    //do whatever you need with this entity
    //run through all sub-entities
    foreach (Entity ent in entity.SubEntities) {
    //run through all attributes of this entity
    foreach (EntityAttr attr in entity.Attributes) {
        //do whatever you need with this attribute
.  .  .  .  .  .  .  .  .  .  .
//to start the process just call this function for the root entity and your model


, 2014/10/08 09:28

I have edmx file and in order to generate the DBModel i am using below code.

model.LoadFromContext(typeof(DBEntities), DataModel.ContextOptions.JoinUsingPrimitiveTypes | DataModel.ContextOptions.ScanOnlyQueryable);

But the count of tables is 0 in this. ALthough the tables get loaded in the query panel but the sqlQuerybuilder buildsql method gives error message "No enough information to build the query"

I tried using this code: model.LoadFromEdmx("LimeWeb.edmx");
But too is not working.

Can you please suggest a proper method to use the edmx file and load the tables in the QUery Panel and get the sql query in the sql textbox ?

, 2014/11/10 17:54
LoadFromContext does not load "tables" - it's used to create the list of entities and their attributes by some "context" class.
The model populated this way can be used only for generation of LINQ queries (not SQL).

LoadFromEdmx should help. What exactly doesn't work in your case?
You can send your .edmx file to together with your comments. We will try to find out the reason of your project.
, 2015/03/17 00:36
This is not working for me either

Neither LoadFromContext nor LoadFromEDMX is working

I keep getting "no enought information to build the query"

A inspection of the query object reveals that the columns selected are present, but no tables

What is the workaround for this?

Please help
, 2015/03/17 05:17
As I said before. LoadFromContext will work only for LINQ queries (through LinqQueryBuilder).
As for LoadFromEdmx - please contact us through contact/support form on our web-site ( and we find the reason of the problem.
, 2015/07/01 12:44
Hello Team,
i want to hide the entities in the view can i do it ? please help me in this issue ASAP.
, 2015/07/01 16:07
To do it ASAP you need to buy a license (it includes priority support as well) and initiate a support request.
, 2015/07/01 16:09
As for your question.
Yes it's possible to hide some entities. You can simply find necessary ones using API (like model.EntityRoot.SubEntities.FindByName("...");)
and then set UseInConditions and UseInResult properties for found entities to false.
Enter your comment: