Reputation: 662
I am struggling to format code in C# in Visual Studio if it is written for the Fluent API of Entity Framework.
Something like this:
_db.ProdSmartSorts
.Where(x => catIds.Contains((int)x.Product.CategoryId))
.OrderBy(x => x.ProdSmartId)
.Select(x => x.Product)
.Include(p => p.Pictures.Where(pic => pic.IsCover))
.Skip(prodCount * (pageNumber - 1))
.Take(prodCount)
.ToList();
What I want:
.ThenInclude()
furtherWhat I have:
Is there a (hidden) setting for this? Are there any extensions which solve this?
Upvotes: -1
Views: 76
Reputation: 328
I tried the method you mentioned, and it does meet some of the requirements.
However, this method is not customizable and can only perform the functions mentioned in the documentation: Wrap call chains document
If you want better customization for the formatting you mentioned, the built-in features of VS may not provide much help.
Upvotes: -1
Reputation: 949
The formatting options in Visual Studio can be found under Tools > Options > Text Editor > C# (or any other supported language)
, but afaik VS doesn't offer, what you want.
I use Jetbrains Resharper to add more formatting options to my ide. Unfourtunately, it is not free and has a noticable performance impact (at least when editing large files). Though it does support the requested "one dot per line" formatting ("wrap chained method calls"), all follow-up-rows are indented to the same level. Individual formatting of selected methods is not possible.
Upvotes: -1