How I can get sql table name in linq
For example :
In linq my table object name is : TblUserDetail
.
But this table name in sql is TblUserDetails
.
How I can get sql table name in linq
For example :
In linq my table object name is : TblUserDetail
.
But this table name in sql is TblUserDetails
.
Try this:
var model = _db.Mapping; //_db is the datacontext instance
foreach (var mt in model.GetTables())
Console.WriteLine(mt.TableName);
This will list all sql tables' names.
Quoted from Get all table names
Ling2sql drops the 's' because the plural is used to identify a collection of TblUserDetails in a related entity.
Probably your TblUSer entity will have a TblUserDetails collection (assumption: you have a 1:n relationship)