Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with dotnet-format #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Abstractions/IEntity/IEntity{TSelf,TId}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ namespace Dgmjr.EntityFrameworkCore.Abstractions;

public interface IEntity<TSelf, TId> : IEntity<TId>, IEquatable<IEntity<TId>>
where TSelf : IEntity<TSelf, TId>
where TId : IComparable, IEquatable<TId> { }
where TId : IComparable, IEquatable<TId>
{ }
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ namespace Dgmjr.EntityFrameworkCore.Abstractions;

public interface ITimestampedEntity<TSelf, TId, TUserId> : ITimestampedEntity<TId, TUserId>
where TSelf : ITimestampedEntity<TSelf, TId, TUserId>
where TId : IComparable, IEquatable<TId> { }
where TId : IComparable, IEquatable<TId>
{ }
49 changes: 25 additions & 24 deletions src/Migrations/CreateFunctionOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,29 @@ namespace Dgmjr.EntityFrameworkCore.Migrations;
public class CreateFunctionOperation(string schema, string name, string arguments, string body)
: SqlOperation
{
public string Schema { get; set; } = schema;
public string Name { get; set; } = name;
public string Arguments { get; set; } = arguments;
public string Body { get; set; } = body;

public override string Sql =>
Format(CreateOrAlterFunctionPattern, Schema, Name, Arguments, Body);

public CreateFunctionOperation(
MethodInfo mi,
string body,
string schema = DboSchema.ShortName,
string? name = default,
string? arguments = default
)
: this(
schema,
name ?? mi.Name,
arguments
?? mi.GetParameters()
.Select(p => $"@{p.Name} {ClrTypeToSqlTypeMap[p.ParameterType]}")
.Join(", "),
body
) { }
public string Schema { get; set; } = schema;
public string Name { get; set; } = name;
public string Arguments { get; set; } = arguments;
public string Body { get; set; } = body;

public override string Sql =>
Format(CreateOrAlterFunctionPattern, Schema, Name, Arguments, Body);

public CreateFunctionOperation(
MethodInfo mi,
string body,
string schema = DboSchema.ShortName,
string? name = default,
string? arguments = default
)
: this(
schema,
name ?? mi.Name,
arguments
?? mi.GetParameters()
.Select(p => $"@{p.Name} {ClrTypeToSqlTypeMap[p.ParameterType]}")
.Join(", "),
body
)
{ }
}
10 changes: 5 additions & 5 deletions src/Migrations/DropFunctionOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace Dgmjr.EntityFrameworkCore.Migrations;

public class DropFunctionOperation(string schema, string name) : SqlOperation
{
public string Schema { get; set; } = schema;
public string Name { get; set; } = name;
public override bool IsDestructiveChange => true;
public override string Sql => Format(DropFunctionIfExistsPattern, Schema, Name);
public string Schema { get; set; } = schema;
public string Name { get; set; } = name;
public override bool IsDestructiveChange => true;

public override string Sql => Format(DropFunctionIfExistsPattern, Schema, Name);
}