Context
I retrieve a list of sites from a database like this:
DashboardEntities dashboardDB = new DashboardEntities();
var sites = dashboardDB.Instances
.Select(attr => new SiteModel
{
server = attr.server,
pool = attr.pool,
url = attr.url,
version = attr.version,
client = ???
})
.ToList();
return sites;
For client
, I need to get a substring from the url like this:
String client = "";
Regex rgx = new Regex(@"\.[a-z-./]+");
client = rgx.Replace(attr.url, "");
rgx = new Regex("formation-");
client = rgx.Replace(client, "");
Question
How do this string manipulation with regex into my LINQ query?