Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to know if a sql server column is full text indexed via EF?

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.

like image 601
Pit Ming Avatar asked Dec 13 '25 16:12

Pit Ming


2 Answers

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.

like image 85
Ivan Karajas Avatar answered Dec 15 '25 05:12

Ivan Karajas


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

like image 45
Ladislav Mrnka Avatar answered Dec 15 '25 04:12

Ladislav Mrnka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!