-2

If I have a database in each table where the ID field and its appropriate function in any field do not take the administrator behavior so that tables and field contents can be fetched until the serial number is unified without duplicate values Appropriate in this context using except. Is there a code that can fetch tables either in sql or in the Entity Framework ؟

Eexcept_Admin_except_List

  List<int> tempIdList = answeripE.Select(q => q.ID).ToList();
var quslist = db.Qustion.Where(q => !tempIdList.Contains(q.ID));

\Thanks for the creator of "daryal" Get All Except from SQL database using Entity Framework

I need to do this without asking for each table and querying it. And also request SQL from the database as a whole without exception such as

select*
 IDfield 
FROM 
  MSDB_Table T 
WHERE
T.id == MaxBy(T.OrderBy(x => x.id);

can replace "where TABLE1.id 'OR' Table2.id" decode all the tables and give a result.

All I'm looking forward to is that I can query one database on a whole, get it on a list without the use of tables or a composite key because it serves me in analyzing a set of data converted to other data formats, for example when representing a database in the form of JSON There are a lot of them on more than one platform and in a single database and to avoid the repetition of the data I need to do this or a comprehensive query may be compared or to investigate or like Solver Tool in Excel, so far did not get the answer to show me the first step is because it does not exist originally or because it is not possible?

Sultan
  • 701
  • 1
  • 6
  • 19
  • 5
    This question needs a bit more work (well maybe more than a bit), its unclear what you are asking – TheGeneral Jun 11 '19 at 06:12
  • 2
    Try introducing some grammar to your sentences as well. That very long open statement is one long unbroken sentence and very difficult to read and understand what your intentions are. Also *"If I have a database in each table "*; A table doesn't contain a database; a table is an object within a database (and a database can have many tables). It's not the other way around. – Thom A Jun 11 '19 at 07:50
  • like Solver Tool in Excel – Sultan Jun 26 '19 at 21:48

1 Answers1

0

If you want Entity Framework to retrieve all columns except a subset of them, the best way to do that is either via a stored procedure or a view. With a view you can query it using LINQ and add your predicates in code, but in a stored procedure you will have to write it and feed your predicate conditions into it...so it sounds like a view would be better for you.

Old example, but should guide you through the process: https://www.mssqltips.com/sqlservertip/1990/how-to-use-sql-server-views-with-the-entity-framework/

How 'bout a Fresca
  • 2,267
  • 1
  • 15
  • 26
  • All I'm looking forward to is that I can query one database and get it from a list without the use of the tables or the keys because it serves me in the analysis of a set of data converted to other formats of data, for example when representing the database in the form of JSON There are a lot of them on more than one platform and in a single database and to avoid the repetition of the data I need to do this or a comprehensive query may be compared or to investigate so far did not get the answer to show me the first step is because it does not exist originally? – Sultan Jun 26 '19 at 21:10