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

Merge develpment into master branch #77

Merged
merged 9 commits into from
Jun 18, 2024
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ csharp_style_prefer_readonly_struct_member = true
# Code-block preferences
csharp_prefer_braces = true
csharp_prefer_simple_using_statement = true
csharp_style_namespace_declarations = block_scoped
csharp_style_namespace_declarations = file_scoped
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_primary_constructors = true
csharp_style_prefer_top_level_statements = true
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin/
obj/
.vs/
.vs/
/.idea/.idea**
14 changes: 5 additions & 9 deletions N.EntityFrameworkCore.Extensions.Test/Common/Config.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration;

namespace N.EntityFrameworkCore.Extensions.Test.Common
namespace N.EntityFrameworkCore.Extensions.Test.Common;

public class Config
{
public class Config
public static string GetConnectionString(string name)
{
public static string GetConnectionString(string name)
{
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

return builder.Build().GetConnectionString(name);
}
}
}
15 changes: 4 additions & 11 deletions N.EntityFrameworkCore.Extensions.Test/Data/Enums/ProductStatus.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace N.EntityFrameworkCore.Extensions.Test.Data.Enums;

namespace N.EntityFrameworkCore.Extensions.Test.Data.Enums
public enum ProductStatus
{
public enum ProductStatus
{
InStock,
OutOfStock,
}
InStock,
OutOfStock,
}
51 changes: 25 additions & 26 deletions N.EntityFrameworkCore.Extensions.Test/Data/Order.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
using System;
using System.ComponentModel.DataAnnotations;

namespace N.EntityFrameworkCore.Extensions.Test.Data
namespace N.EntityFrameworkCore.Extensions.Test.Data;

public class Order
{
public class Order
[Key]
public long Id { get; set; }
public string ExternalId { get; set; }
public Guid? GlobalId { get; set; }
public decimal Price { get; set; }
public DateTime AddedDateTime { get; set; }
public DateTime? ModifiedDateTime { get; set; }
public DateTimeOffset? ModifiedDateTimeOffset { get; set; }
public DateTime DbAddedDateTime { get; set; }
public DateTime DbModifiedDateTime { get; set; }
public bool? Trigger { get; set; }
public bool Active { get; set; }
public OrderStatus Status { get; set; }
public Order()
{
[Key]
public long Id { get; set; }
public string ExternalId { get; set; }
public Guid? GlobalId { get; set; }
public decimal Price { get; set; }
public DateTime AddedDateTime { get; set; }
public DateTime? ModifiedDateTime { get; set; }
public DateTimeOffset? ModifiedDateTimeOffset { get; set; }
public DateTime DbAddedDateTime { get; set; }
public DateTime DbModifiedDateTime { get; set; }
public bool? Trigger { get; set; }
public bool Active { get; set; }
public OrderStatus Status { get; set; }
public Order()
{
AddedDateTime = DateTime.UtcNow;
Active = true;
}
AddedDateTime = DateTime.UtcNow;
Active = true;
}
}

public enum OrderStatus
{
Unknown,
Completed,
Error
}
public enum OrderStatus
{
Unknown,
Completed,
Error
}
17 changes: 5 additions & 12 deletions N.EntityFrameworkCore.Extensions.Test/Data/Position.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace N.EntityFrameworkCore.Extensions.Test.Data;

namespace N.EntityFrameworkCore.Extensions.Test.Data
public class Position
{
public class Position
{
public int Building;
public int Aisle;
public int Bay;
}
public int Building;
public int Aisle;
public int Bay;
}
45 changes: 21 additions & 24 deletions N.EntityFrameworkCore.Extensions.Test/Data/Product.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using N.EntityFrameworkCore.Extensions.Test.Data.Enums;

namespace N.EntityFrameworkCore.Extensions.Test.Data
namespace N.EntityFrameworkCore.Extensions.Test.Data;

public class Product
{
public class Product
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string Id { get; set; }
[StringLength(50)]
public string Name { get; set; }
public decimal Price { get; set; }
public bool OutOfStock { get; set; }
[Column("Status")]
[StringLength(25)]
public string StatusString { get; set; }
public int? ProductCategoryId { get; set; }
public System.Drawing.Color Color { get; set; }
public ProductStatus? StatusEnum { get; set; }
public DateTime? UpdatedDateTime { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string Id { get; set; }
[StringLength(50)]
public string Name { get; set; }
public decimal Price { get; set; }
public bool OutOfStock { get; set; }
[Column("Status")]
[StringLength(25)]
public string StatusString { get; set; }
public int? ProductCategoryId { get; set; }
public System.Drawing.Color Color { get; set; }
public ProductStatus? StatusEnum { get; set; }
public DateTime? UpdatedDateTime { get; set; }

public Position Position { get; set; }
public Position Position { get; set; }

public virtual ProductCategory ProductCategory { get; set; }
public Product()
{
public virtual ProductCategory ProductCategory { get; set; }
public Product()
{

}
}
}
19 changes: 5 additions & 14 deletions N.EntityFrameworkCore.Extensions.Test/Data/ProductCategory.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using N.EntityFrameworkCore.Extensions.Test.Data.Enums;
namespace N.EntityFrameworkCore.Extensions.Test.Data;

namespace N.EntityFrameworkCore.Extensions.Test.Data
public class ProductCategory
{
public class ProductCategory
{
public int Id { get; set; }
public string Name { get; set; }
public bool Active { get; internal set; }
}
public int Id { get; set; }
public string Name { get; set; }
public bool Active { get; internal set; }
}
37 changes: 16 additions & 21 deletions N.EntityFrameworkCore.Extensions.Test/Data/ProductWithComplexKey.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace N.EntityFrameworkCore.Extensions.Test.Data
namespace N.EntityFrameworkCore.Extensions.Test.Data;

public class ProductWithComplexKey
{
public class ProductWithComplexKey
public Guid Key1 { get; set; }
public Guid Key2 { get; set; }
public Guid Key3 { get; set; }
public decimal Price { get; set; }
public bool OutOfStock { get; set; }
[Column("Status")]
[StringLength(25)]
public string StatusString { get; set; }
public DateTime? UpdatedDateTime { get; set; }
public ProductWithComplexKey()
{
public Guid Key1 { get; set; }
public Guid Key2 { get; set; }
public Guid Key3 { get; set; }
public decimal Price { get; set; }
public bool OutOfStock { get; set; }
[Column("Status")]
[StringLength(25)]
public string StatusString { get; set; }
public DateTime? UpdatedDateTime { get; set; }
public ProductWithComplexKey()
{
//Key1 = Guid.NewGuid();
//Key2 = Guid.NewGuid();
//Key3 = Guid.NewGuid();
}
//Key1 = Guid.NewGuid();
//Key2 = Guid.NewGuid();
//Key3 = Guid.NewGuid();
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using N.EntityFrameworkCore.Extensions.Test.Data.Enums;

namespace N.EntityFrameworkCore.Extensions.Test.Data
namespace N.EntityFrameworkCore.Extensions.Test.Data;

public class ProductWithCustomSchema
{
public class ProductWithCustomSchema
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string Id { get; set; }
[StringLength(50)]
public string Name { get; set; }
public decimal Price { get; set; }
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string Id { get; set; }
[StringLength(50)]
public string Name { get; set; }
public decimal Price { get; set; }
}
22 changes: 22 additions & 0 deletions N.EntityFrameworkCore.Extensions.Test/Data/ProductWithTrigger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace N.EntityFrameworkCore.Extensions.Test.Data;

public class ProductWithTrigger
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string Id { get; set; }
[StringLength(50)]
public string Name { get; set; }
public decimal Price { get; set; }
public bool OutOfStock { get; set; }
[Column("Status")]
[StringLength(25)]
public string StatusString { get; set; }
public ProductWithTrigger()
{

}
}
Loading
Loading