Skip to content

Commit f8c3608

Browse files
2881028810
authored andcommitted
源代码改用vs默认格式化
1 parent 873364c commit f8c3608

File tree

309 files changed

+76463
-70243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

309 files changed

+76463
-70243
lines changed

Examples/benchmarker/Program.cs

Lines changed: 225 additions & 202 deletions
Large diffs are not rendered by default.

Examples/dbcontext_01/Controllers/ValuesController.cs

Lines changed: 188 additions & 174 deletions
Large diffs are not rendered by default.

Examples/dbcontext_01/DbContexts/SongContext.cs

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,55 @@
33
using System;
44
using System.Collections.Generic;
55

6-
namespace dbcontext_01 {
7-
8-
public class SongContext : DbContext {
9-
10-
public DbSet<Song> Songs { get; set; }
11-
public DbSet<Tag> Tags { get; set; }
12-
13-
//protected override void OnConfiguring(DbContextOptionsBuilder builder) {
14-
// builder.UseFreeSql(dbcontext_01.Startup.Fsql);
15-
//}
16-
}
17-
18-
19-
public class Song {
20-
[Column(IsIdentity = true)]
21-
public int Id { get; set; }
22-
public DateTime? Create_time { get; set; }
23-
public bool? Is_deleted { get; set; }
24-
public string Title { get; set; }
25-
public string Url { get; set; }
26-
27-
public virtual ICollection<Tag> Tags { get; set; }
28-
29-
[Column(IsVersion = true)]
30-
public long versionRow { get; set; }
31-
}
32-
public class Song_tag {
33-
public int Song_id { get; set; }
34-
public virtual Song Song { get; set; }
35-
36-
public int Tag_id { get; set; }
37-
public virtual Tag Tag { get; set; }
38-
}
39-
40-
public class Tag {
41-
[Column(IsIdentity = true)]
42-
public int Id { get; set; }
43-
public int? Parent_id { get; set; }
44-
public virtual Tag Parent { get; set; }
45-
46-
public decimal? Ddd { get; set; }
47-
public string Name { get; set; }
48-
49-
public virtual ICollection<Song> Songs { get; set; }
50-
public virtual ICollection<Tag> Tags { get; set; }
51-
}
6+
namespace dbcontext_01
7+
{
8+
9+
public class SongContext : DbContext
10+
{
11+
12+
public DbSet<Song> Songs { get; set; }
13+
public DbSet<Tag> Tags { get; set; }
14+
15+
//protected override void OnConfiguring(DbContextOptionsBuilder builder) {
16+
// builder.UseFreeSql(dbcontext_01.Startup.Fsql);
17+
//}
18+
}
19+
20+
21+
public class Song
22+
{
23+
[Column(IsIdentity = true)]
24+
public int Id { get; set; }
25+
public DateTime? Create_time { get; set; }
26+
public bool? Is_deleted { get; set; }
27+
public string Title { get; set; }
28+
public string Url { get; set; }
29+
30+
public virtual ICollection<Tag> Tags { get; set; }
31+
32+
[Column(IsVersion = true)]
33+
public long versionRow { get; set; }
34+
}
35+
public class Song_tag
36+
{
37+
public int Song_id { get; set; }
38+
public virtual Song Song { get; set; }
39+
40+
public int Tag_id { get; set; }
41+
public virtual Tag Tag { get; set; }
42+
}
43+
44+
public class Tag
45+
{
46+
[Column(IsIdentity = true)]
47+
public int Id { get; set; }
48+
public int? Parent_id { get; set; }
49+
public virtual Tag Parent { get; set; }
50+
51+
public decimal? Ddd { get; set; }
52+
public string Name { get; set; }
53+
54+
public virtual ICollection<Song> Songs { get; set; }
55+
public virtual ICollection<Tag> Tags { get; set; }
56+
}
5257
}

Examples/dbcontext_01/Program.cs

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,51 +17,56 @@ namespace dbcontext_01
1717
public class Program
1818
{
1919

20-
public class Song {
21-
[Column(IsIdentity = true)]
22-
public int Id { get; set; }
23-
public string BigNumber { get; set; }
20+
public class Song
21+
{
22+
[Column(IsIdentity = true)]
23+
public int Id { get; set; }
24+
public string BigNumber { get; set; }
2425

25-
[Column(IsVersion = true)]//使用简单
26-
public long versionRow { get; set; }
27-
}
26+
[Column(IsVersion = true)]//使用简单
27+
public long versionRow { get; set; }
28+
}
2829

29-
public class SongContext : DbContext {
30+
public class SongContext : DbContext
31+
{
3032

31-
public DbSet<Song> Songs { get; set; }
33+
public DbSet<Song> Songs { get; set; }
3234

33-
protected override void OnConfiguring(DbContextOptionsBuilder builder) {
34-
builder.UseFreeSql(fsql);
35-
}
36-
}
37-
static IFreeSql fsql;
38-
public static void Main(string[] args) {
39-
fsql = new FreeSql.FreeSqlBuilder()
40-
.UseConnectionString(FreeSql.DataType.Sqlite, @"Data Source=|DataDirectory|\dd2.db;Pooling=true;Max Pool Size=10")
41-
.UseAutoSyncStructure(true)
42-
.UseLazyLoading(true)
43-
.UseNoneCommandParameter(true)
35+
protected override void OnConfiguring(DbContextOptionsBuilder builder)
36+
{
37+
builder.UseFreeSql(fsql);
38+
}
39+
}
40+
static IFreeSql fsql;
41+
public static void Main(string[] args)
42+
{
43+
fsql = new FreeSql.FreeSqlBuilder()
44+
.UseConnectionString(FreeSql.DataType.Sqlite, @"Data Source=|DataDirectory|\dd2.db;Pooling=true;Max Pool Size=10")
45+
.UseAutoSyncStructure(true)
46+
.UseLazyLoading(true)
47+
.UseNoneCommandParameter(true)
4448

45-
.UseMonitorCommand(cmd => Trace.WriteLine(cmd.CommandText))
46-
.Build();
49+
.UseMonitorCommand(cmd => Trace.WriteLine(cmd.CommandText))
50+
.Build();
4751

4852

49-
using (var ctx = new SongContext()) {
50-
var song = new Song { BigNumber = "1000000000000000000" };
51-
ctx.Songs.Add(song);
53+
using (var ctx = new SongContext())
54+
{
55+
var song = new Song { BigNumber = "1000000000000000000" };
56+
ctx.Songs.Add(song);
5257

53-
ctx.Songs.Update(song);
58+
ctx.Songs.Update(song);
5459

55-
song.BigNumber = (BigInteger.Parse(song.BigNumber) + 1).ToString();
56-
ctx.Songs.Update(song);
60+
song.BigNumber = (BigInteger.Parse(song.BigNumber) + 1).ToString();
61+
ctx.Songs.Update(song);
5762

58-
ctx.SaveChanges();
63+
ctx.SaveChanges();
5964

60-
var sql = fsql.Update<Song>().SetSource(song).ToSql();
61-
}
65+
var sql = fsql.Update<Song>().SetSource(song).ToSql();
66+
}
6267

63-
CreateWebHostBuilder(args).Build().Run();
64-
}
68+
CreateWebHostBuilder(args).Build().Run();
69+
}
6570

6671
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
6772
WebHost.CreateDefaultBuilder(args)
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
{
2-
"iisSettings": {
3-
"windowsAuthentication": false,
4-
"anonymousAuthentication": true,
5-
"iisExpress": {
6-
"applicationUrl": "http://localhost:53030/",
7-
"sslPort": 0
8-
}
9-
},
10-
"profiles": {
11-
"IIS Express": {
12-
"commandName": "IISExpress",
13-
"launchBrowser": true,
14-
"environmentVariables": {
15-
"ASPNETCORE_ENVIRONMENT": "Development"
16-
}
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:53030/",
7+
"sslPort": 0
8+
}
179
},
18-
"dbcontext_01": {
19-
"commandName": "Project",
20-
"launchBrowser": true,
21-
"environmentVariables": {
22-
"ASPNETCORE_ENVIRONMENT": "Development"
23-
},
24-
"applicationUrl": "http://localhost:53031/"
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"dbcontext_01": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"environmentVariables": {
22+
"ASPNETCORE_ENVIRONMENT": "Development"
23+
},
24+
"applicationUrl": "http://localhost:53031/"
25+
}
2526
}
26-
}
2727
}

0 commit comments

Comments
 (0)