mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update demo
This commit is contained in:
parent
f0cffe712b
commit
a97843b3b6
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Data.Linq.Mapping;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
20
Src/Asp.Net/MySqlTest/Models/AttributeTable.cs
Normal file
20
Src/Asp.Net/MySqlTest/Models/AttributeTable.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
[Table("MyAttributeTable")]
|
||||
//[SugarTable("CustomAttributeTable")]
|
||||
public class AttributeTable
|
||||
{
|
||||
|
||||
[Key]
|
||||
//[SugarColumn(IsPrimaryKey =true)]
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
15
Src/Asp.Net/MySqlTest/Models/EntityMapper.cs
Normal file
15
Src/Asp.Net/MySqlTest/Models/EntityMapper.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
namespace OrmTest
|
||||
{
|
||||
[SugarTable("MyEntityMapper")]
|
||||
public class EntityMapper
|
||||
{
|
||||
[SugarColumn(ColumnName ="MyName")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
54
Src/Asp.Net/MySqlTest/Models/Mapper.cs
Normal file
54
Src/Asp.Net/MySqlTest/Models/Mapper.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
[SugarTable("OrderDetail")]
|
||||
public class OrderItemInfo
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int ItemId { get; set; }
|
||||
public int OrderId { get; set; }
|
||||
public decimal? Price { get; set; }
|
||||
[SqlSugar.SugarColumn(IsNullable = true)]
|
||||
public DateTime? CreateTime { get; set; }
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public Order Order { get; set; }
|
||||
}
|
||||
[SugarTable("Order")]
|
||||
public class OrderInfo
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<OrderItem> Items { get; set; }
|
||||
}
|
||||
public class ABMapping
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int AId { get; set; }
|
||||
public int BId { get; set; }
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public A A { get; set; }
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public B B { get; set; }
|
||||
|
||||
}
|
||||
public class A
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
public class B
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -8,14 +9,16 @@ namespace OrmTest
|
||||
|
||||
public class Order
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
[SqlSugar.SugarColumn(IsNullable = true)]
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
[SqlSugar.SugarColumn(IsNullable =true)]
|
||||
[SugarColumn(IsNullable =true)]
|
||||
public int CustomId { get; set; }
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<OrderItem> Items { get; set; }
|
||||
}
|
||||
}
|
||||
|
17
Src/Asp.Net/MySqlTest/Models/TestTree.cs
Normal file
17
Src/Asp.Net/MySqlTest/Models/TestTree.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
public class TestTree
|
||||
{
|
||||
[SqlSugar.SugarColumn(ColumnDataType = "hierarchyid")]
|
||||
public string TreeId { get; set; }
|
||||
[SqlSugar.SugarColumn(ColumnDataType = "Geography")]
|
||||
public string GId { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
@ -67,12 +67,16 @@
|
||||
<Compile Include="Demo\DemoE_CodeFirst.cs" />
|
||||
<Compile Include="Demo\DemoF_Utilities.cs" />
|
||||
<Compile Include="Demo\DemoG_SimpleClient.cs" />
|
||||
<Compile Include="Models\AttributeTable.cs" />
|
||||
<Compile Include="Models\CarType.cs" />
|
||||
<Compile Include="Models\Custom.cs" />
|
||||
<Compile Include="Models\Mappers.cs" />
|
||||
<Compile Include="Models\EntityMapper.cs" />
|
||||
<Compile Include="Models\Mapper.cs" />
|
||||
<Compile Include="Models\MyCustomAttributeTable.cs" />
|
||||
<Compile Include="Models\Order.cs" />
|
||||
<Compile Include="Models\OrderItem.cs" />
|
||||
<Compile Include="Models\TestTree.cs" />
|
||||
<Compile Include="Models\Tree.cs" />
|
||||
<Compile Include="Models\ViewOrder.cs" />
|
||||
<Compile Include="OldTests\Demos\1_Query.cs" />
|
||||
<Compile Include="OldTests\Demos\2_Update.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user