Comments (3)
Some minimal API samples from the Microsoft's documentation
app.MapPost("/todoitems", async (Todo todo, TodoDb db) =>
{
db.Todos.Add(todo);
await db.SaveChangesAsync();
return Results.Created($"/todoitems/{todo.Id}", todo);
});
app.MapPut("/todoitems/{id}", async (int id, Todo inputTodo, TodoDb db) =>
{
var todo = await db.Todos.FindAsync(id);
if (todo is null) return Results.NotFound();
todo.Name = inputTodo.Name;
todo.IsComplete = inputTodo.IsComplete;
await db.SaveChangesAsync();
return Results.NoContent();
});
app.MapDelete("/todoitems/{id}", async (int id, TodoDb db) =>
{
if (await db.Todos.FindAsync(id) is Todo todo)
{
db.Todos.Remove(todo);
await db.SaveChangesAsync();
return Results.NoContent();
}
return Results.NotFound();
});
from csharpier.
FWIW prettier appears to avoid breaking arguments when one of them is a lambda. I haven't looked into the code to see if this was intenional or not, but I assume that it was.
Prettier output
await SessionManager.Session(cancellationToken, async (context) => {
var records = await context.DbContext.Entity.AsNoTracking()
.Where(
context.DbContext.PredicateFor(criteria).TranslatedBy(MkEntityPredicates),
)
.ToListAsync(context.CancellationToken);
var entities = await MarshalEntities(records);
return entities.ToImmutableDictionary((e) => e.Id.Value);
});
from csharpier.
Sorry, to be clear this is using prettier with prettier-plugin-csharp?
I'd be fine with wrapping arguments when they contain a lambda which is not block-bodied, e.g.
var exception = Assert.Throws<Exception>(
() => my.Incredibly.Long.Ass.Lambda.Expression
);
but blocks should probably be treated as blocks regardless of where they appear:
var exception = Assert.Throws<Exception>(() =>
{
throw new Exception();
});
from csharpier.
Related Issues (20)
- using static System.* usings not ordered before other static usings like using System.* ones
- Spacing after StyleCop.Analyzers file header
- CSharper does not recognize class primary constructor HOT 2
- Spread (in collection expression) are not formatted
- Using aliases sorting is not always the same depending on the input order
- Extra indent when call method on RawStringLiteral HOT 1
- Add more options to CodeFormatterOptions HOT 1
- editorconfig dotnet_sort_system_directives_first = false ignored HOT 2
- VSCode extension support local csharpier install HOT 2
- Visual Studio stopped responding for 9 seconds. Disabling the extension CSharpier 1.5.1 might help. HOT 8
- CSharpier can not support slice[] grama, HOT 3
- CSharpier unable to run dotnet commands HOT 17
- Extra newline in switch case statement with curly braces HOT 1
- Support VSCode Format on Save Modifications Only Mode HOT 1
- Cannot format project containing editorconfig
- Rider - dotnet not found HOT 2
- Issue Formatting Region HOT 4
- Docs use C# instead of CS for code-blocks HOT 1
- Formatting doesn't work with multiple project files in a folder HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csharpier.