mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
## v0.8.7
- 修复 导航关系多属性时的错序 bug; - 修复 延时属性的类,没有设置Namespace时的 bug;
This commit is contained in:
parent
a62d07d2b7
commit
b0314f643e
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>BaseEntity 是一种极简单的 CodeFirst 开发方式,特别对单表或多表CRUD,利用继承节省了每个实体类的重复属性(创建时间、ID等字段),软件删除等功能,进行 crud 操作时不必时常考虑仓储的使用.</Description>
|
<Description>BaseEntity 是一种极简单的 CodeFirst 开发方式,特别对单表或多表CRUD,利用继承节省了每个实体类的重复属性(创建时间、ID等字段),软件删除等功能,进行 crud 操作时不必时常考虑仓储的使用.</Description>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql 扩展包,可实现【延时加载】属性.</Description>
|
<Description>FreeSql 扩展包,可实现【延时加载】属性.</Description>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql is the most convenient ORM in dotnet. It supports Mysql, Postgresql, SqlServer, Oracle and Sqlite.</Description>
|
<Description>FreeSql is the most convenient ORM in dotnet. It supports Mysql, Postgresql, SqlServer, Oracle and Sqlite.</Description>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql Implementation of General Repository, Support MySql/SqlServer/PostgreSQL/Oracle/Sqlite, and read/write separation、and split table.</Description>
|
<Description>FreeSql Implementation of General Repository, Support MySql/SqlServer/PostgreSQL/Oracle/Sqlite, and read/write separation、and split table.</Description>
|
||||||
<PackageProjectUrl>https://github.com/2881099/FreeSql/wiki/Repository</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/2881099/FreeSql/wiki/Repository</PackageProjectUrl>
|
||||||
|
67
FreeSql.Tests/FreeSql.Tests/Other/AnswerQuestionnaire.cs
Normal file
67
FreeSql.Tests/FreeSql.Tests/Other/AnswerQuestionnaire.cs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
// Website: http://www.freesql.net
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using FreeSql.DataAnnotations;
|
||||||
|
|
||||||
|
[JsonObject(MemberSerialization.OptIn)]
|
||||||
|
public partial class AnswerQuestionnaire
|
||||||
|
{
|
||||||
|
|
||||||
|
[JsonProperty, Column(IsPrimary = true)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[JsonProperty, Column(DbType = "varchar(50)")]
|
||||||
|
public string RecordId
|
||||||
|
{
|
||||||
|
get => _recordid;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_recordid != value)
|
||||||
|
{
|
||||||
|
_recordid = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _recordid;
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
public short? TypeId
|
||||||
|
{
|
||||||
|
get => _typeid;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_typeid != value)
|
||||||
|
{
|
||||||
|
_typeid = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private short? _typeid;
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
#region 外键 => 导航属性,ManyToOne/OneToOne
|
||||||
|
|
||||||
|
|
||||||
|
[Navigate("RecordId, TypeId")]
|
||||||
|
public virtual MedicalRecord MedicalRecord { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 外键 => 导航属性,ManyToMany
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
50
FreeSql.Tests/FreeSql.Tests/Other/MedicalRecord.cs
Normal file
50
FreeSql.Tests/FreeSql.Tests/Other/MedicalRecord.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
// Website: http://www.freesql.net
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using FreeSql.DataAnnotations;
|
||||||
|
|
||||||
|
[JsonObject(MemberSerialization.OptIn)]
|
||||||
|
public partial class MedicalRecord
|
||||||
|
{
|
||||||
|
|
||||||
|
[JsonProperty, Column(DbType = "varchar(50)", IsPrimary = true)]
|
||||||
|
public string RecordId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty, Column(IsPrimary = true)]
|
||||||
|
public short TypeId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty, Column(DbType = "decimal(9,2)")]
|
||||||
|
public decimal InsuranceAmount { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
public DateTime? LastModifyTime { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty, Column(DbType = "decimal(9,2)")]
|
||||||
|
public decimal SelfAmount { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty, Column(DbType = "decimal(9,2)")]
|
||||||
|
public decimal TotalAmount { get; set; }
|
||||||
|
|
||||||
|
#region 外键 => 导航属性,OneToMany
|
||||||
|
|
||||||
|
[Navigate("TypeId, RecordId")]
|
||||||
|
public virtual List<AnswerQuestionnaire> AnswerQuestionnaires { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 外键 => 导航属性,ManyToMany
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
@ -347,6 +347,10 @@ namespace FreeSql.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void Test1()
|
||||||
{
|
{
|
||||||
|
var kdkdfm = g.sqlite.Select<AnswerQuestionnaire>()
|
||||||
|
.Include(a => a.MedicalRecord)
|
||||||
|
.ToSql();
|
||||||
|
|
||||||
var dkdkd = g.mysql.Select<TaskBuild>().AsTable((t,old) => "TaskBuild22")
|
var dkdkd = g.mysql.Select<TaskBuild>().AsTable((t,old) => "TaskBuild22")
|
||||||
.ToList< TestDto>(a => new TestDto()
|
.ToList< TestDto>(a => new TestDto()
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,7 @@ public static partial class FreeSqlGlobalExtensions
|
|||||||
public static bool IsNullableType(this Type that) => that?.FullName.StartsWith("System.Nullable`1[") == true;
|
public static bool IsNullableType(this Type that) => that?.FullName.StartsWith("System.Nullable`1[") == true;
|
||||||
public static bool IsAnonymousType(this Type that) => that?.FullName.StartsWith("<>f__AnonymousType") == true;
|
public static bool IsAnonymousType(this Type that) => that?.FullName.StartsWith("<>f__AnonymousType") == true;
|
||||||
public static Type NullableTypeOrThis(this Type that) => that?.IsNullableType() == true ? that.GenericTypeArguments.First() : that;
|
public static Type NullableTypeOrThis(this Type that) => that?.IsNullableType() == true ? that.GenericTypeArguments.First() : that;
|
||||||
|
internal static string NotNullAndConcat(this string that, params object[] args) => string.IsNullOrEmpty(that) ? null : string.Concat(new object[] { that }.Concat(args));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 测量两个经纬度的距离,返回单位:米
|
/// 测量两个经纬度的距离,返回单位:米
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql is the most convenient ORM in dotnet. It supports Mysql, Postgresql, SqlServer, Oracle and Sqlite.</Description>
|
<Description>FreeSql is the most convenient ORM in dotnet. It supports Mysql, Postgresql, SqlServer, Oracle and Sqlite.</Description>
|
||||||
|
@ -244,7 +244,7 @@ namespace FreeSql.Internal
|
|||||||
tbc.AddOrUpdate(entity, trytb, (oldkey, oldval) => trytb);
|
tbc.AddOrUpdate(entity, trytb, (oldkey, oldval) => trytb);
|
||||||
|
|
||||||
#region 查找导航属性的关系、virtual 属性延时加载,动态产生新的重写类
|
#region 查找导航属性的关系、virtual 属性延时加载,动态产生新的重写类
|
||||||
var trytbTypeName = trytb.Type.IsNested ? $"{trytb.Type.DeclaringType.Namespace}.{trytb.Type.DeclaringType.Name}.{trytb.Type.Name}" : $"{trytb.Type.Namespace}.{trytb.Type.Name}";
|
var trytbTypeName = trytb.Type.IsNested ? $"{trytb.Type.DeclaringType.Namespace?.NotNullAndConcat(".")}{trytb.Type.DeclaringType.Name}.{trytb.Type.Name}" : $"{trytb.Type.Namespace?.NotNullAndConcat(".")}{trytb.Type.Name}";
|
||||||
var trytbTypeLazyName = default(string);
|
var trytbTypeLazyName = default(string);
|
||||||
var overrieds = 0;
|
var overrieds = 0;
|
||||||
StringBuilder cscode = null;
|
StringBuilder cscode = null;
|
||||||
@ -270,8 +270,8 @@ namespace FreeSql.Internal
|
|||||||
var vp = propsLazy.Where(a => a.Item1 == pnv).FirstOrDefault();
|
var vp = propsLazy.Where(a => a.Item1 == pnv).FirstOrDefault();
|
||||||
var isLazy = vp.Item1 != null && !string.IsNullOrEmpty(trytbTypeLazyName);
|
var isLazy = vp.Item1 != null && !string.IsNullOrEmpty(trytbTypeLazyName);
|
||||||
var propTypeName = pnv.PropertyType.IsGenericType ?
|
var propTypeName = pnv.PropertyType.IsGenericType ?
|
||||||
$"{pnv.PropertyType.Namespace}.{pnv.PropertyType.Name.Remove(pnv.PropertyType.Name.IndexOf('`'))}<{string.Join(", ", pnv.PropertyType.GenericTypeArguments.Select(a => a.IsNested ? $"{a.DeclaringType.Namespace}.{a.DeclaringType.Name}.{a.Name}" : $"{a.Namespace}.{a.Name}"))}>" :
|
$"{pnv.PropertyType.Namespace?.NotNullAndConcat(".")}{pnv.PropertyType.Name.Remove(pnv.PropertyType.Name.IndexOf('`'))}<{string.Join(", ", pnv.PropertyType.GenericTypeArguments.Select(a => a.IsNested ? $"{a.DeclaringType.Namespace?.NotNullAndConcat(".")}{a.DeclaringType.Name}.{a.Name}" : $"{a.Namespace?.NotNullAndConcat(".")}{a.Name}"))}>" :
|
||||||
(pnv.PropertyType.IsNested ? $"{pnv.PropertyType.DeclaringType.Namespace}.{pnv.PropertyType.DeclaringType.Name}.{pnv.PropertyType.Name}" : $"{pnv.PropertyType.Namespace}.{pnv.PropertyType.Name}");
|
(pnv.PropertyType.IsNested ? $"{pnv.PropertyType.DeclaringType.Namespace?.NotNullAndConcat(".")}{pnv.PropertyType.DeclaringType.Name}.{pnv.PropertyType.Name}" : $"{pnv.PropertyType.Namespace?.NotNullAndConcat(".")}{pnv.PropertyType.Name}");
|
||||||
|
|
||||||
var pnvAttr = pnv.GetCustomAttribute<NavigateAttribute>();
|
var pnvAttr = pnv.GetCustomAttribute<NavigateAttribute>();
|
||||||
var pnvBind = pnvAttr?.Bind?.Split(',').Select(a => a.Trim()).Where(a => !string.IsNullOrEmpty(a)).ToArray();
|
var pnvBind = pnvAttr?.Bind?.Split(',').Select(a => a.Trim()).Where(a => !string.IsNullOrEmpty(a)).ToArray();
|
||||||
@ -294,7 +294,7 @@ namespace FreeSql.Internal
|
|||||||
var tbref = propElementType == trytb.Type ? trytb : GetTableByEntity(propElementType, common); //可能是父子关系
|
var tbref = propElementType == trytb.Type ? trytb : GetTableByEntity(propElementType, common); //可能是父子关系
|
||||||
if (tbref == null) continue;
|
if (tbref == null) continue;
|
||||||
|
|
||||||
var tbrefTypeName = tbref.Type.IsNested ? $"{tbref.Type.DeclaringType.Namespace}.{tbref.Type.DeclaringType.Name}.{tbref.Type.Name}" : $"{tbref.Type.Namespace}.{tbref.Type.Name}";
|
var tbrefTypeName = tbref.Type.IsNested ? $"{tbref.Type.DeclaringType.Namespace?.NotNullAndConcat(".")}{tbref.Type.DeclaringType.Name}.{tbref.Type.Name}" : $"{tbref.Type.Namespace?.NotNullAndConcat(".")}{tbref.Type.Name}";
|
||||||
Type midType = null;
|
Type midType = null;
|
||||||
var isManyToMany = false;
|
var isManyToMany = false;
|
||||||
|
|
||||||
@ -357,29 +357,29 @@ namespace FreeSql.Internal
|
|||||||
if (midType == null)
|
if (midType == null)
|
||||||
{
|
{
|
||||||
midType = trytb.Type.IsNested ?
|
midType = trytb.Type.IsNested ?
|
||||||
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace}.{trytb.Type.DeclaringType.Name}+{trytb.CsName}{tbref.CsName}{midFlagStr}", false, true) : //SongTag
|
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace?.NotNullAndConcat(".")}{trytb.Type.DeclaringType.Name}+{trytb.CsName}{tbref.CsName}{midFlagStr}", false, true) : //SongTag
|
||||||
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace}.{trytb.CsName}{tbref.CsName}{midFlagStr}", false, true);
|
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace?.NotNullAndConcat(".")}{trytb.CsName}{tbref.CsName}{midFlagStr}", false, true);
|
||||||
valiManyToMany();
|
valiManyToMany();
|
||||||
}
|
}
|
||||||
if (midType == null)
|
if (midType == null)
|
||||||
{
|
{
|
||||||
midType = trytb.Type.IsNested ?
|
midType = trytb.Type.IsNested ?
|
||||||
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace}.{trytb.Type.DeclaringType.Name}+{trytb.CsName}_{tbref.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true) : //Song_Tag
|
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace?.NotNullAndConcat(".")}{trytb.Type.DeclaringType.Name}+{trytb.CsName}_{tbref.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true) : //Song_Tag
|
||||||
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace}.{trytb.CsName}_{tbref.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true);
|
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace?.NotNullAndConcat(".")}{trytb.CsName}_{tbref.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true);
|
||||||
valiManyToMany();
|
valiManyToMany();
|
||||||
}
|
}
|
||||||
if (midType == null)
|
if (midType == null)
|
||||||
{
|
{
|
||||||
midType = trytb.Type.IsNested ?
|
midType = trytb.Type.IsNested ?
|
||||||
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace}.{trytb.Type.DeclaringType.Name}+{tbref.CsName}{trytb.CsName}{midFlagStr}", false, true) : //TagSong
|
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace?.NotNullAndConcat(".")}{trytb.Type.DeclaringType.Name}+{tbref.CsName}{trytb.CsName}{midFlagStr}", false, true) : //TagSong
|
||||||
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace}.{tbref.CsName}{trytb.CsName}{midFlagStr}", false, true);
|
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace?.NotNullAndConcat(".")}{tbref.CsName}{trytb.CsName}{midFlagStr}", false, true);
|
||||||
valiManyToMany();
|
valiManyToMany();
|
||||||
}
|
}
|
||||||
if (midType == null)
|
if (midType == null)
|
||||||
{
|
{
|
||||||
midType = trytb.Type.IsNested ?
|
midType = trytb.Type.IsNested ?
|
||||||
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace}.{trytb.Type.DeclaringType.Name}+{tbref.CsName}_{trytb.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true) : //Tag_Song
|
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace?.NotNullAndConcat(".")}{trytb.Type.DeclaringType.Name}+{tbref.CsName}_{trytb.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true) : //Tag_Song
|
||||||
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace}.{tbref.CsName}_{trytb.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true);
|
trytb.Type.Assembly.GetType($"{trytb.Type.Namespace?.NotNullAndConcat(".")}{tbref.CsName}_{trytb.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true);
|
||||||
valiManyToMany();
|
valiManyToMany();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -388,29 +388,29 @@ namespace FreeSql.Internal
|
|||||||
if (midType == null)
|
if (midType == null)
|
||||||
{
|
{
|
||||||
midType = tbref.Type.IsNested ?
|
midType = tbref.Type.IsNested ?
|
||||||
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace}.{tbref.Type.DeclaringType.Name}+{trytb.CsName}{tbref.CsName}{midFlagStr}", false, true) : //SongTag
|
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace?.NotNullAndConcat(".")}{tbref.Type.DeclaringType.Name}+{trytb.CsName}{tbref.CsName}{midFlagStr}", false, true) : //SongTag
|
||||||
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace}.{trytb.CsName}{tbref.CsName}{midFlagStr}", false, true);
|
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace?.NotNullAndConcat(".")}{trytb.CsName}{tbref.CsName}{midFlagStr}", false, true);
|
||||||
valiManyToMany();
|
valiManyToMany();
|
||||||
}
|
}
|
||||||
if (midType == null)
|
if (midType == null)
|
||||||
{
|
{
|
||||||
midType = tbref.Type.IsNested ?
|
midType = tbref.Type.IsNested ?
|
||||||
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace}.{tbref.Type.DeclaringType.Name}+{trytb.CsName}_{tbref.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true) : //Song_Tag
|
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace?.NotNullAndConcat(".")}{tbref.Type.DeclaringType.Name}+{trytb.CsName}_{tbref.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true) : //Song_Tag
|
||||||
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace}.{trytb.CsName}_{tbref.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true);
|
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace?.NotNullAndConcat(".")}{trytb.CsName}_{tbref.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true);
|
||||||
valiManyToMany();
|
valiManyToMany();
|
||||||
}
|
}
|
||||||
if (midType == null)
|
if (midType == null)
|
||||||
{
|
{
|
||||||
midType = tbref.Type.IsNested ?
|
midType = tbref.Type.IsNested ?
|
||||||
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace}.{tbref.Type.DeclaringType.Name}+{tbref.CsName}{trytb.CsName}{midFlagStr}", false, true) : //TagSong
|
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace?.NotNullAndConcat(".")}{tbref.Type.DeclaringType.Name}+{tbref.CsName}{trytb.CsName}{midFlagStr}", false, true) : //TagSong
|
||||||
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace}.{tbref.CsName}{trytb.CsName}{midFlagStr}", false, true);
|
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace?.NotNullAndConcat(".")}{tbref.CsName}{trytb.CsName}{midFlagStr}", false, true);
|
||||||
valiManyToMany();
|
valiManyToMany();
|
||||||
}
|
}
|
||||||
if (midType == null)
|
if (midType == null)
|
||||||
{
|
{
|
||||||
midType = tbref.Type.IsNested ?
|
midType = tbref.Type.IsNested ?
|
||||||
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace}.{tbref.Type.DeclaringType.Name}+{tbref.CsName}_{trytb.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true) : //Tag_Song
|
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace?.NotNullAndConcat(".")}{tbref.Type.DeclaringType.Name}+{tbref.CsName}_{trytb.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true) : //Tag_Song
|
||||||
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace}.{tbref.CsName}_{trytb.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true);
|
tbref.Type.Assembly.GetType($"{tbref.Type.Namespace?.NotNullAndConcat(".")}{tbref.CsName}_{trytb.CsName}{(string.IsNullOrEmpty(midFlagStr) ? "" : "_")}{midFlagStr}", false, true);
|
||||||
valiManyToMany();
|
valiManyToMany();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -605,7 +605,7 @@ namespace FreeSql.Internal
|
|||||||
|
|
||||||
if (nvref.Exception == null)
|
if (nvref.Exception == null)
|
||||||
cscode.Append(" base.").Append(pnv.Name).Append(" = __fsql_orm__.Select<").Append(propElementType.IsNested ? $"{propElementType.DeclaringType.Namespace}.{propElementType.DeclaringType.Name}.{propElementType.Name}" : $"{propElementType.Namespace}.{propElementType.Name}")
|
cscode.Append(" base.").Append(pnv.Name).Append(" = __fsql_orm__.Select<").Append(propElementType.IsNested ? $"{propElementType.DeclaringType.Namespace}.{propElementType.DeclaringType.Name}.{propElementType.Name}" : $"{propElementType.Namespace}.{propElementType.Name}")
|
||||||
.Append(">().Where(a => __fsql_orm__.Select<").Append(tbmid.Type.IsNested ? $"{tbmid.Type.DeclaringType.Namespace}.{tbmid.Type.DeclaringType.Name}.{tbmid.Type.Name}" : $"{tbmid.Type.Namespace}.{tbmid.Type.Name}")
|
.Append(">().Where(a => __fsql_orm__.Select<").Append(tbmid.Type.IsNested ? $"{tbmid.Type.DeclaringType.Namespace?.NotNullAndConcat(".")}{tbmid.Type.DeclaringType.Name}.{tbmid.Type.Name}" : $"{tbmid.Type.Namespace}.{tbmid.Type.Name}")
|
||||||
.Append(">().Where(b => ").Append(lmbdWhere.ToString()).AppendLine(").Any()).ToList();")
|
.Append(">().Where(b => ").Append(lmbdWhere.ToString()).AppendLine(").Any()).ToList();")
|
||||||
.Append(" __lazy__").Append(pnv.Name).AppendLine(" = true;");
|
.Append(" __lazy__").Append(pnv.Name).AppendLine(" = true;");
|
||||||
else
|
else
|
||||||
@ -656,7 +656,7 @@ namespace FreeSql.Internal
|
|||||||
if (trytb.Primarys.Select(a => a.CsType).Distinct().Count() == trytb.Primarys.Length)
|
if (trytb.Primarys.Select(a => a.CsType).Distinct().Count() == trytb.Primarys.Length)
|
||||||
{
|
{
|
||||||
var pkList = trytb.Primarys.ToList();
|
var pkList = trytb.Primarys.ToList();
|
||||||
bindColumns.Sort((a, b) => pkList.FindIndex(c => c.CsType == a.CsType).CompareTo(pkList.FindIndex(c => c.CsType == b.CsType)));
|
bindColumns.Sort((a, b) => pkList.FindIndex(c => c.CsType == a.CsType.NullableTypeOrThis()).CompareTo(pkList.FindIndex(c => c.CsType == b.CsType.NullableTypeOrThis())));
|
||||||
}
|
}
|
||||||
else if (string.Compare(string.Join(",", trytb.Primarys.Select(a => a.CsName).OrderBy(a => a)), string.Join(",", bindColumns.Select(a => a.CsName).OrderBy(a => a)), true) == 0)
|
else if (string.Compare(string.Join(",", trytb.Primarys.Select(a => a.CsName).OrderBy(a => a)), string.Join(",", bindColumns.Select(a => a.CsName).OrderBy(a => a)), true) == 0)
|
||||||
{
|
{
|
||||||
@ -738,7 +738,7 @@ namespace FreeSql.Internal
|
|||||||
|
|
||||||
if (nvref.Exception == null)
|
if (nvref.Exception == null)
|
||||||
{
|
{
|
||||||
cscode.Append(" base.").Append(pnv.Name).Append(" = __fsql_orm__.Select<").Append(propElementType.IsNested ? $"{propElementType.DeclaringType.Namespace}.{propElementType.DeclaringType.Name}.{propElementType.Name}" : $"{propElementType.Namespace}.{propElementType.Name}").Append(">().Where(a => ").Append(lmbdWhere.ToString()).AppendLine(").ToList();");
|
cscode.Append(" base.").Append(pnv.Name).Append(" = __fsql_orm__.Select<").Append(propElementType.IsNested ? $"{propElementType.DeclaringType.Namespace?.NotNullAndConcat(".")}{propElementType.DeclaringType.Name}.{propElementType.Name}" : $"{propElementType.Namespace?.NotNullAndConcat(".")}{propElementType.Name}").Append(">().Where(a => ").Append(lmbdWhere.ToString()).AppendLine(").ToList();");
|
||||||
if (refprop != null)
|
if (refprop != null)
|
||||||
{
|
{
|
||||||
cscode.Append(" foreach (var loc1 in base.").Append(pnv.Name).AppendLine(")")
|
cscode.Append(" foreach (var loc1 in base.").Append(pnv.Name).AppendLine(")")
|
||||||
@ -772,7 +772,7 @@ namespace FreeSql.Internal
|
|||||||
trytb.AddOrUpdateTableRef(pnv.Name, nvref);
|
trytb.AddOrUpdateTableRef(pnv.Name, nvref);
|
||||||
//if (isLazy) throw nvref.Exception;
|
//if (isLazy) throw nvref.Exception;
|
||||||
}
|
}
|
||||||
var tbrefTypeName = tbref.Type.IsNested ? $"{tbref.Type.DeclaringType.Namespace}.{tbref.Type.DeclaringType.Name}.{tbref.Type.Name}" : $"{tbref.Type.Namespace}.{tbref.Type.Name}";
|
var tbrefTypeName = tbref.Type.IsNested ? $"{tbref.Type.DeclaringType.Namespace?.NotNullAndConcat(".")}{tbref.Type.DeclaringType.Name}.{tbref.Type.Name}" : $"{tbref.Type.Namespace?.NotNullAndConcat(".")}{tbref.Type.Name}";
|
||||||
var isOnoToOne = pnv.PropertyType != trytb.Type &&
|
var isOnoToOne = pnv.PropertyType != trytb.Type &&
|
||||||
tbref.Properties.Where(z => z.Value.PropertyType == trytb.Type).Any() &&
|
tbref.Properties.Where(z => z.Value.PropertyType == trytb.Type).Any() &&
|
||||||
tbref.Primarys.Length == trytb.Primarys.Length &&
|
tbref.Primarys.Length == trytb.Primarys.Length &&
|
||||||
@ -806,7 +806,7 @@ namespace FreeSql.Internal
|
|||||||
if (tbref.Primarys.Select(a => a.CsType).Distinct().Count() == tbref.Primarys.Length)
|
if (tbref.Primarys.Select(a => a.CsType).Distinct().Count() == tbref.Primarys.Length)
|
||||||
{
|
{
|
||||||
var pkList = tbref.Primarys.ToList();
|
var pkList = tbref.Primarys.ToList();
|
||||||
bindColumns.Sort((a, b) => pkList.FindIndex(c => c.CsType == a.CsType).CompareTo(pkList.FindIndex(c => c.CsType == b.CsType)));
|
bindColumns.Sort((a, b) => pkList.FindIndex(c => c.CsType == a.CsType.NullableTypeOrThis()).CompareTo(pkList.FindIndex(c => c.CsType == b.CsType.NullableTypeOrThis())));
|
||||||
}
|
}
|
||||||
else if (string.Compare(string.Join(",", tbref.Primarys.Select(a => a.CsName).OrderBy(a => a)), string.Join(",", bindColumns.Select(a => a.CsName).OrderBy(a => a)), true) == 0)
|
else if (string.Compare(string.Join(",", tbref.Primarys.Select(a => a.CsName).OrderBy(a => a)), string.Join(",", bindColumns.Select(a => a.CsName).OrderBy(a => a)), true) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql 数据库实现,基于 MySql 5.6</Description>
|
<Description>FreeSql 数据库实现,基于 MySql 5.6</Description>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql 数据库实现,基于 MySql 5.6</Description>
|
<Description>FreeSql 数据库实现,基于 MySql 5.6</Description>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql 数据库实现,基于 Oracle 11</Description>
|
<Description>FreeSql 数据库实现,基于 Oracle 11</Description>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql 数据库实现,基于 PostgreSQL 9.5</Description>
|
<Description>FreeSql 数据库实现,基于 PostgreSQL 9.5</Description>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net451</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net451</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql 数据库实现,基于 SqlServer 2005+,并根据版本适配分页方法:row_number 或 offset fetch next</Description>
|
<Description>FreeSql 数据库实现,基于 SqlServer 2005+,并根据版本适配分页方法:row_number 或 offset fetch next</Description>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||||
<Version>0.8.6</Version>
|
<Version>0.8.7</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql 数据库实现,基于 Sqlite 3.0</Description>
|
<Description>FreeSql 数据库实现,基于 Sqlite 3.0</Description>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user