3

I'm building a request generator based on EF and Linq.Expression. I was wondering if there is a way to get column info via something somewhere in EF.

I'm looking for the information about full text index that you can see in property windows in SQl Server.

Can someone help ?

For information, here is a T-SQL request that retrieve this info for table PitMingTable:

select sc.name, columnproperty(OBJECT_ID('PitMingTable'),sc.name,'IsFulltextIndexed')
from sysobjects so
inner join syscolumns sc on so.id = sc.id
where so.name like 'PitMingTable' and so.xtype ='u'

Thx.

Pit Ming
  • 401
  • 2
  • 5
  • 13

3 Answers3

2

I would assume that this is outside the scope of the Entity Framework, seeing as it generates the entity data model at compile-time. A DBA could modify a database to index a column and the data model would have no way of updating itself to reflect this. Additionally, the Entity Framework is designed to be database-agnostic and there is no convention for exposing this sort of metadata consistently between different database platforms.

If you don't mind getting your hands dirty with a bit of SQL you could always write a stored proc to find out this sort of thing. This answer: List of all index & index columns in SQL Server DB should give you a head start, assuming you're using SQL Server.

Community
  • 1
  • 1
Ivan Karajas
  • 1,081
  • 8
  • 14
1

No. EF doesn't have any native support for querying database metadata but you can take your SQL and execute it through EF (ExecuteStoreQuery).

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
0

You can execute query using your context. To get a list of full text indexes use this:

SELECT * FROM sys.fulltext_indexes

Here is description: sys.fulltext_indexes

If you don't want to use sql queries I think you can add view sys.fulltext_indexes to your model and work with it using EF.

algreat
  • 8,592
  • 5
  • 41
  • 54