├── icon.jpg
├── remark.txt
├── MegoPublicKey.snk
├── test
└── Caredev.Mego.Tests
│ ├── Resources
│ ├── EmptyAccess2000.mdb
│ ├── EmptyAccess2003.mdb
│ ├── EmptyExcel2003.xls
│ ├── EmptyExcel2010.xlsx
│ └── EmptyAccess2010.accdb
│ ├── MySql
│ ├── FunctionTest.cs
│ ├── Query
│ │ ├── Simple
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ │ └── Inherit
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ ├── Constants.cs
│ └── Commit
│ │ └── Simple
│ │ └── DeleteTest.cs
│ ├── SqlServer
│ ├── FunctionTest.cs
│ ├── Query
│ │ ├── Simple
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ │ └── Inherit
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ └── Constants.cs
│ ├── Access
│ ├── Query
│ │ └── Simple
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ ├── Constants.cs
│ └── Commit
│ │ └── Simple
│ │ ├── DeleteTest.cs
│ │ └── UpdatePropertysTest.cs
│ ├── Excel
│ ├── Query
│ │ └── Simple
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ ├── Constants.cs
│ └── Commit
│ │ └── Simple
│ │ └── UpdatePropertysTest.cs
│ ├── SqlServerCe
│ ├── Query
│ │ └── Simple
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ ├── Constants.cs
│ ├── Commit
│ │ └── Simple
│ │ │ ├── DeleteTest.cs
│ │ │ └── UpdatePropertysTest.cs
│ └── DbFeatureTest.cs
│ ├── SQLite
│ ├── Query
│ │ ├── Simple
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ │ └── Inherit
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ ├── Constants.cs
│ └── Commit
│ │ └── Simple
│ │ └── DeleteTest.cs
│ ├── Oracle
│ ├── Query
│ │ └── Simple
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ ├── Commit
│ │ └── Simple
│ │ │ ├── DeleteTest.cs
│ │ │ └── UpdatePropertysTest.cs
│ └── Constants.cs
│ ├── PostgreSQL
│ ├── Query
│ │ ├── Simple
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ │ └── Inherit
│ │ │ ├── SqlQueryTest.cs
│ │ │ └── SingleEntityTest.cs
│ ├── Constants.cs
│ └── Commit
│ │ └── Simple
│ │ └── DeleteTest.cs
│ ├── Constants·.cs
│ ├── Core
│ ├── Constants.cs
│ ├── Query
│ │ ├── Simple
│ │ │ └── SqlQueryTest.cs
│ │ └── Inherit
│ │ │ └── SqlQueryTest.cs
│ └── FunctionTest.cs
│ ├── Common
│ ├── GeneratedGuidAttribute.cs
│ └── GeneratedDateTimeAttribute.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── packages.config
│ └── Firebird
│ └── Constants.cs
├── src
└── Caredev.Mego
│ ├── DataAnnotations
│ ├── IColumnAnnotation.cs
│ ├── IConcurrencyCheck.cs
│ ├── KeyAttribute.cs
│ ├── NotMappedAttribute.cs
│ ├── ConcurrencyCheckAttribute.cs
│ ├── EObjectRelationMode.cs
│ ├── NullableAttribute.cs
│ ├── DefaultAttribute.cs
│ ├── StringAttribute.cs
│ ├── GeneratedIgnoreAttribute.cs
│ ├── ComputedAttribute.cs
│ ├── GeneratedValueAttribute.cs
│ ├── PrecisionAttribute.cs
│ ├── GeneratedValueBaseAttribute.cs
│ ├── LengthAttribute.cs
│ ├── GeneratedExpressionAttribute.cs
│ ├── RelationActionAttribute.cs
│ ├── GeneratedMemoryValueAttribute.cs
│ ├── IdentityAttribute.cs
│ ├── ColumnAttribute.cs
│ ├── InversePropertyAttribute.cs
│ └── DbFunctionAttribute.cs
│ ├── DbCustomMembers.cs
│ ├── IContextContent.cs
│ ├── Resolve
│ ├── Outputs
│ │ ├── IOutputContent.cs
│ │ ├── OutputInfoBase.cs
│ │ ├── ISingleOutput.cs
│ │ ├── IMultiOutput.cs
│ │ ├── EOutputType.cs
│ │ ├── EObjectOutputOption.cs
│ │ ├── GroupCollectionImpl.cs
│ │ ├── OutputContentObject.cs
│ │ ├── SingleValueOutputInfo.cs
│ │ └── MultiValueOutputInfo.cs
│ ├── Expressions
│ │ ├── IDbExpression.cs
│ │ ├── EOrderKind.cs
│ │ ├── IDbDefaultUnitType.cs
│ │ ├── EMapFunctionKind.cs
│ │ ├── IDbExpandUnitExpression.cs
│ │ ├── IDbMemberExpression.cs
│ │ ├── IDbUnitItemTypeExpression.cs
│ │ ├── IDbUnitTypeExpression.cs
│ │ ├── EConnectKind.cs
│ │ ├── EUnaryKind.cs
│ │ ├── DbDataItemExpression.cs
│ │ ├── DbDefaultExpression.cs
│ │ ├── DbOriginalObjectExpression.cs
│ │ ├── DbItemFunctionExpression.cs
│ │ ├── DbScalarFunctionExpression.cs
│ │ ├── DbSelectExpression.cs
│ │ ├── DbJudgeFunctionExpression.cs
│ │ ├── DbUnitItemTypeExpression.cs
│ │ ├── DbRetrievalFunctionExpression.cs
│ │ ├── DbUnitItemContentExpression.cs
│ │ ├── DbMapFunctionExpression.cs
│ │ ├── DbAggregateFunctionExpression.cs
│ │ ├── DbSetOperationExpression.cs
│ │ ├── DbNewExpression.cs
│ │ ├── DbUnitObjectContentExpression.cs
│ │ ├── DbGroupJoinExpression.cs
│ │ ├── DbOrderExpression.cs
│ │ ├── DbUnitValueContentExpression.cs
│ │ ├── DbConstantExpression.cs
│ │ ├── DbJoinKeyPairExpression.cs
│ │ ├── DbMemberExpression.cs
│ │ ├── DbSetFunctionExpression.cs
│ │ ├── DbCrossJoinExpression.cs
│ │ ├── DbGroupItemExpression.cs
│ │ ├── DbDataSetExpression.cs
│ │ ├── DbUnitFunctionExpression.cs
│ │ ├── DbGroupSetExpression.cs
│ │ ├── DbExpression.cs
│ │ ├── DbSetConnectExpression.cs
│ │ └── DbUnaryExpression.cs
│ ├── ValueGenerates
│ │ ├── ValueGenerateIgnore.cs
│ │ ├── ValueGenerateIdentity.cs
│ │ ├── ValueGenerateBase.cs
│ │ ├── ValueGenerateDatabase.cs
│ │ ├── IMemoryValueGenerator.cs
│ │ ├── EGeneratedPurpose.cs
│ │ ├── EGeneratedOption.cs
│ │ ├── ValueGenerateExpression.cs
│ │ └── ValueGenerateMemory.cs
│ ├── Metadatas
│ │ ├── IPropertyMetadata.cs
│ │ ├── MemberKind.cs
│ │ ├── TypeMetadataBase.cs
│ │ ├── ForeignPrincipalPair.cs
│ │ ├── MemberMetadata.cs
│ │ └── CompositeNavigateMetadata.cs
│ ├── Providers
│ │ ├── MySqlAccessProvider.cs
│ │ ├── SqlServerAccessProvider.cs
│ │ ├── DB2AccessProvider.cs
│ │ ├── PostgreSQLAccessProvider.cs
│ │ ├── SQLiteAccessProvider.cs
│ │ ├── FirebirdAccessProvider.cs
│ │ └── SqlServerCeAccessProvider.cs
│ ├── Operates
│ │ ├── IInsertReferenceRelation.cs
│ │ ├── IConcurrencyCheckOperate.cs
│ │ ├── DbDeleteStatementOperate.cs
│ │ ├── DbInsertStatementOperate.cs
│ │ ├── DbUpdateStatementOperate.cs
│ │ ├── IDbSplitObjectsOperate.cs
│ │ ├── DbDropObjectOperate.cs
│ │ ├── DbObjectIsExsitOperate.cs
│ │ ├── DbQueryOperateBase.cs
│ │ ├── DbCreateTableOperate.cs
│ │ ├── DbRenameObjectOperate.cs
│ │ ├── DbMaintenanceOperateBase.cs
│ │ ├── DbStatementOperateBase.cs
│ │ ├── DbPropertysOperateBase.cs
│ │ ├── DbRelationItem.cs
│ │ ├── EDatabaseObject.cs
│ │ └── DbQueryObjectOperate.cs
│ ├── Generators
│ │ ├── ECommitValueType.cs
│ │ ├── Fragments
│ │ │ ├── ESetOperate.cs
│ │ │ └── EJoinType.cs
│ │ ├── Contents
│ │ │ ├── QueryContent.cs
│ │ │ ├── MaintenanceContent.cs
│ │ │ ├── UpdateContent.cs
│ │ │ ├── DeleteContent.cs
│ │ │ ├── IContentUnit.cs
│ │ │ ├── InheritDeleteContent.cs
│ │ │ └── InsertContent.cs
│ │ ├── CommitIdentityUnit.cs
│ │ ├── CommitExpressionMember.cs
│ │ ├── CommitKeyUnit.cs
│ │ ├── CommitUnitBase.cs
│ │ ├── SqlGeneratorBase.Statement.cs
│ │ └── Implement
│ │ │ └── ExcelGenerator.cs
│ ├── EDbNameKind.cs
│ ├── EReferenceAction.cs
│ ├── EExecutionMode.cs
│ ├── Commands
│ │ ├── ECommandExecuteMode.cs
│ │ └── ICustomCommand.cs
│ ├── IPropertyValueLoader.cs
│ ├── ValueConversion
│ │ ├── GuidToStringConverter.cs
│ │ ├── GuidToByteArrayConverter.cs
│ │ └── BooleanToInt32Converter.cs
│ └── IDbSqlGenerator.cs
│ ├── IDbSet.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── DbQuery`.cs
│ ├── Exceptions
│ ├── GeneratorNotFoundException.cs
│ ├── GenerateException.cs
│ └── DbCommitConcurrencyException.cs
│ ├── Common
│ └── InheritTypeComparer.cs
│ └── DbFunctions.cs
└── README.md
/icon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CarefreeXT/Mego/HEAD/icon.jpg
--------------------------------------------------------------------------------
/remark.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CarefreeXT/Mego/HEAD/remark.txt
--------------------------------------------------------------------------------
/MegoPublicKey.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CarefreeXT/Mego/HEAD/MegoPublicKey.snk
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Resources/EmptyAccess2000.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CarefreeXT/Mego/HEAD/test/Caredev.Mego.Tests/Resources/EmptyAccess2000.mdb
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Resources/EmptyAccess2003.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CarefreeXT/Mego/HEAD/test/Caredev.Mego.Tests/Resources/EmptyAccess2003.mdb
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Resources/EmptyExcel2003.xls:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CarefreeXT/Mego/HEAD/test/Caredev.Mego.Tests/Resources/EmptyExcel2003.xls
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Resources/EmptyExcel2010.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CarefreeXT/Mego/HEAD/test/Caredev.Mego.Tests/Resources/EmptyExcel2010.xlsx
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Resources/EmptyAccess2010.accdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CarefreeXT/Mego/HEAD/test/Caredev.Mego.Tests/Resources/EmptyAccess2010.accdb
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/MySql/FunctionTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core
2 | {
3 | public partial class FunctionTest
4 | {
5 | private const string CustomFunctionTestSql =
6 | @"SELECT
7 | a.`Id`,
8 | a.`Name`,
9 | ABS(a.`Id`) AS `AbsId`
10 | FROM `customers` AS a;";
11 | }
12 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/SqlServer/FunctionTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core
2 | {
3 | public partial class FunctionTest
4 | {
5 | private const string CustomFunctionTestSql =
6 | @"SELECT a.[Id] ,
7 | a.[Name] ,
8 | ABS(a.[Id]) AS [AbsId]
9 | FROM [dbo].[Customers] AS a;";
10 | }
11 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Access/Query/Simple/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Simple
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT Id FROM Products";
6 |
7 | private const string SqlQueryCollectionTestSql = @"SELECT Id ,Code ,Name ,Category ,IsValid FROM Products";
8 | }
9 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Excel/Query/Simple/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Simple
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT Id FROM Products";
6 |
7 | private const string SqlQueryCollectionTestSql = @"SELECT Id ,Code ,Name ,Category ,IsValid FROM Products";
8 | }
9 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/SqlServerCe/Query/Simple/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Simple
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT Id FROM Products";
6 |
7 | private const string SqlQueryCollectionTestSql = @"SELECT Id ,Code ,Name ,Category ,IsValid FROM Products";
8 | }
9 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/MySql/Query/Simple/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Simple
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT `Id` FROM `Products`";
6 |
7 | private const string SqlQueryCollectionTestSql = @"SELECT `Id` ,`Code` ,`Name` ,`Category` ,`IsValid` FROM `Products`";
8 | }
9 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/SqlServer/Query/Simple/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Simple
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT Id FROM dbo.Products";
6 |
7 | private const string SqlQueryCollectionTestSql = @"SELECT Id ,Code ,Name ,Category ,IsValid FROM dbo.Products";
8 | }
9 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/SQLite/Query/Simple/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Simple
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT [Id] FROM [Products]";
6 |
7 | private const string SqlQueryCollectionTestSql = @"SELECT [Id] ,[Code] ,[Name] ,[Category] ,[IsValid] FROM [Products]";
8 | }
9 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Oracle/Query/Simple/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Simple
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT ""Id"" FROM ""SIMPLE"".""Products""";
6 |
7 | private const string SqlQueryCollectionTestSql = @"SELECT ""Id"" ,""Code"" ,""Name"" ,""Category"" ,""IsValid"" FROM ""SIMPLE"".""Products""";
8 | }
9 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/PostgreSQL/Query/Simple/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Simple
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT ""Id"" FROM ""public"".""Products""";
6 |
7 | private const string SqlQueryCollectionTestSql = @"SELECT ""Id"" ,""Code"" ,""Name"" ,""Category"" ,""IsValid"" FROM ""public"".""Products""";
8 | }
9 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/DataAnnotations/IColumnAnnotation.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.DataAnnotations
5 | {
6 | ///
7 | /// 数据列特性接口,数据列元数据中附加的属性描述都需要实现该接口。
8 | ///
9 | public interface IColumnAnnotation { }
10 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/DataAnnotations/IConcurrencyCheck.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.DataAnnotations
5 | {
6 | ///
7 | /// 实现该接口的数据列特性,将表示所作用到的数据列将参与乐观并发检查。
8 | ///
9 | public interface IConcurrencyCheck : IColumnAnnotation
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/DataAnnotations/KeyAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.DataAnnotations
5 | {
6 | using System;
7 | ///
8 | /// 主键特性。
9 | ///
10 | [AttributeUsage(AttributeTargets.Property)]
11 | public class KeyAttribute : Attribute
12 | {
13 | }
14 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Constants·.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Caredev.Mego.Tests
9 | {
10 | internal partial class Constants
11 | {
12 | public const string TestCategoryFoundation = "`Foundation";
13 |
14 | public const string ConnectionNameSimple = "OrderManageForSqlServer2012";
15 |
16 | public const string NotSuppored = nameof(NotSuppored);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Caredev.Mego/DbCustomMembers.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego
5 | {
6 | ///
7 | /// 自定义数据库成员,用于协助代码生成。
8 | ///
9 | class DbCustomMembers
10 | {
11 | ///
12 | /// 自定义行索引。
13 | ///
14 | public int CustomRowIndex { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/DataAnnotations/NotMappedAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.DataAnnotations
5 | {
6 | using System;
7 | ///
8 | /// 通过该特性指定需要排除映射的属性。
9 | ///
10 | [AttributeUsage(AttributeTargets.Property)]
11 | public sealed class NotMappedAttribute : Attribute
12 | {
13 | }
14 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/IContextContent.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego
5 | {
6 | ///
7 | /// 实现该接口的对象可以提供当前数据上下文的访问属性。
8 | ///
9 | public interface IContextContent
10 | {
11 | ///
12 | /// 数据上下文对象。
13 | ///
14 | DbContext Context { get; }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Outputs/IOutputContent.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Outputs
5 | {
6 | ///
7 | /// 输出内容接口。
8 | ///
9 | public interface IOutputContent
10 | {
11 | ///
12 | /// 当前输出内容。
13 | ///
14 | object Content { get; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/MySql/Query/Inherit/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Inherit
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT Id FROM ProductBases";
6 |
7 | private const string SqlQueryCollectionTestSql =
8 | @"SELECT a.Id ,
9 | a.Code ,
10 | a.Name ,
11 | b.Category ,
12 | b.IsValid ,
13 | b.UpdateDate
14 | FROM ProductBases a
15 | INNER JOIN Products b ON b.Id = a.Id;";
16 | }
17 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/SQLite/Query/Inherit/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Inherit
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT Id FROM ProductBases";
6 |
7 | private const string SqlQueryCollectionTestSql =
8 | @"SELECT a.Id ,
9 | a.Code ,
10 | a.Name ,
11 | b.Category ,
12 | b.IsValid ,
13 | b.UpdateDate
14 | FROM ProductBases a
15 | INNER JOIN Products b ON b.Id = a.Id;";
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/DataAnnotations/ConcurrencyCheckAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.DataAnnotations
5 | {
6 | using System;
7 | ///
8 | /// 指定属性参与乐观并发检查。
9 | ///
10 | [AttributeUsage(AttributeTargets.Property)]
11 | public class ConcurrencyCheckAttribute : Attribute, IConcurrencyCheck
12 | {
13 | }
14 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Outputs/OutputInfoBase.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Outputs
5 | {
6 | ///
7 | /// 输出信息基类。
8 | ///
9 | public abstract class OutputInfoBase
10 | {
11 | ///
12 | /// 输出类型。
13 | ///
14 | public abstract EOutputType Type { get; }
15 | }
16 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/SqlServer/Query/Inherit/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Inherit
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT Id FROM dbo.ProductBases";
6 |
7 | private const string SqlQueryCollectionTestSql =
8 | @"SELECT a.Id ,
9 | a.Code ,
10 | a.Name ,
11 | b.Category ,
12 | b.IsValid ,
13 | b.UpdateDate
14 | FROM dbo.ProductBases a
15 | INNER JOIN dbo.Products b ON b.Id = a.Id;";
16 | }
17 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/PostgreSQL/Query/Inherit/SqlQueryTest.cs:
--------------------------------------------------------------------------------
1 | namespace Caredev.Mego.Tests.Core.Query.Inherit
2 | {
3 | public partial class SqlQueryTest
4 | {
5 | private const string SqlQueryValueTestSql = @"SELECT Id FROM dbo.ProductBases";
6 |
7 | private const string SqlQueryCollectionTestSql =
8 | @"SELECT a.Id ,
9 | a.Code ,
10 | a.Name ,
11 | b.Category ,
12 | b.IsValid ,
13 | b.UpdateDate
14 | FROM dbo.ProductBases a
15 | INNER JOIN dbo.Products b ON b.Id = a.Id;";
16 | }
17 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Core/Constants.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Caredev.Mego.Tests
8 | {
9 | internal partial class Constants
10 | {
11 | public readonly static string ConnectionNameInherit = "IOrderManageFor" + TestCategoryRootName;
12 | public readonly static string ConnectionNameSimple = "OrderManageFor" + TestCategoryRootName;
13 |
14 | public const string NotSuppored = nameof(NotSuppored);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Expressions/IDbExpression.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Expressions
5 | {
6 | ///
7 | /// 所有数据表达式都需要实现的接口。
8 | ///
9 | public interface IDbExpression
10 | {
11 | ///
12 | /// 数据表达式类型。
13 | ///
14 | EExpressionType ExpressionType { get; }
15 | }
16 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Common/GeneratedGuidAttribute.cs:
--------------------------------------------------------------------------------
1 | using Caredev.Mego.DataAnnotations;
2 | using Caredev.Mego.Resolve.ValueGenerates;
3 | using System;
4 | using System.Linq.Expressions;
5 | namespace Caredev.Mego.Tests.Common
6 | {
7 | public class GeneratedGuidAttribute : GeneratedExpressionAttribute
8 | {
9 | public GeneratedGuidAttribute(EGeneratedPurpose purpose = EGeneratedPurpose.Insert)
10 | : base(purpose)
11 | {
12 | Expression = Expression.Call(null, typeof(Guid).GetMethod(nameof(Guid.NewGuid)));
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/ValueGenerates/ValueGenerateIgnore.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.ValueGenerates
5 | {
6 | ///
7 | /// 忽略值生成的对象。
8 | ///
9 | internal sealed class ValueGenerateIgnore : ValueGenerateBase
10 | {
11 | ///
12 | public override EGeneratedOption GeneratedOption => EGeneratedOption.Ignore;
13 | }
14 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Metadatas/IPropertyMetadata.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Metadatas
5 | {
6 | using System.Reflection;
7 | ///
8 | /// 属性元数据接口。
9 | ///
10 | public interface IPropertyMetadata
11 | {
12 | ///
13 | /// 当前元数据成员的CLR描述对象。
14 | ///
15 | PropertyInfo Member { get; }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/ValueGenerates/ValueGenerateIdentity.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.ValueGenerates
5 | {
6 | ///
7 | /// 标识列值生成对象。
8 | ///
9 | internal sealed class ValueGenerateIdentity : ValueGenerateBase
10 | {
11 | ///
12 | public override EGeneratedOption GeneratedOption => EGeneratedOption.Identity;
13 | }
14 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/ValueGenerates/ValueGenerateBase.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.ValueGenerates
5 | {
6 | ///
7 | /// 值生成定义基类。
8 | ///
9 | public abstract class ValueGenerateBase
10 | {
11 | ///
12 | /// 当前值生成的选项。
13 | ///
14 | public abstract EGeneratedOption GeneratedOption { get; }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/ValueGenerates/ValueGenerateDatabase.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.ValueGenerates
5 | {
6 | ///
7 | /// 数据库值生成对象。
8 | ///
9 | internal sealed class ValueGenerateDatabase : ValueGenerateBase
10 | {
11 | ///
12 | public override EGeneratedOption GeneratedOption => EGeneratedOption.Database;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Expressions/EOrderKind.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Expressions
5 | {
6 | ///
7 | /// 排序操作种类。
8 | ///
9 | public enum EOrderKind
10 | {
11 | ///
12 | /// 升序。
13 | ///
14 | Ascending,
15 | ///
16 | /// 降序。
17 | ///
18 | Descending
19 | }
20 | }
--------------------------------------------------------------------------------
/test/Caredev.Mego.Tests/Common/GeneratedDateTimeAttribute.cs:
--------------------------------------------------------------------------------
1 | using Caredev.Mego.DataAnnotations;
2 | using Caredev.Mego.Resolve.ValueGenerates;
3 | using System;
4 | using System.Linq.Expressions;
5 |
6 | namespace Caredev.Mego.Tests.Common
7 | {
8 | public class GeneratedDateTimeAttribute : GeneratedExpressionAttribute
9 | {
10 | public GeneratedDateTimeAttribute(EGeneratedPurpose purpose = EGeneratedPurpose.Update)
11 | : base(purpose)
12 | {
13 | Expression = Expression.MakeMemberAccess(null, typeof(DateTime).GetProperty(nameof(DateTime.Now)));
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Expressions/IDbDefaultUnitType.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Expressions
5 | {
6 | ///
7 | /// 该接口声明当前表达式可用于数据连接操作,若连接的数据为空则用该默认值替换空值。
8 | ///
9 | public interface IDbDefaultUnitType : IDbExpression
10 | {
11 | ///
12 | /// 在数据连接操作中数据为空时的默认值。
13 | ///
14 | DbExpression Default { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Expressions/EMapFunctionKind.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Expressions
5 | {
6 | ///
7 | /// 函数映射种类。
8 | ///
9 | public enum EMapFunctionKind
10 | {
11 | ///
12 | /// 函数(通常对应到数据库标题函数或存储过程等)。
13 | ///
14 | Function,
15 | ///
16 | /// 过程(通常对应到数据库存储过程)。
17 | ///
18 | Action
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Caredev.Mego/IDbSet.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego
5 | {
6 | using System;
7 | using Caredev.Mego.Resolve;
8 | ///
9 | /// 数据集接口
10 | ///
11 | public interface IDbSet : IContextContent
12 | {
13 | ///
14 | /// 数据库名称对象。
15 | ///
16 | DbName Name { get; }
17 | ///
18 | /// 数据项类型。
19 | ///
20 | Type ClrType { get; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Outputs/ISingleOutput.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Outputs
5 | {
6 | using System.Data.Common;
7 | ///
8 | /// 单个值输出接口。
9 | ///
10 | public interface ISingleOutput
11 | {
12 | ///
13 | /// 获取执行结果。
14 | ///
15 | /// 数据读取器。
16 | /// 执行结果。
17 | object GetResult(DbDataReader reader);
18 | }
19 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Providers/MySqlAccessProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Providers
5 | {
6 | ///
7 | /// 访问Nuget组件:MySql.Data
8 | ///
9 | internal class MySqlAccessProvider : DbAccessProvider
10 | {
11 | ///
12 | public override string ProviderName => "MySql.Data.MySqlClient";
13 | ///
14 | public override EExecutionMode ExecutionMode => EExecutionMode.MergeOperations;
15 | }
16 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Operates/IInsertReferenceRelation.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Operates
5 | {
6 | using System.Collections.Generic;
7 | ///
8 | /// 当添加数据和关系存在关联时,系统会自动同时提交相关操作,
9 | /// 该接口用于在插入操作对象中声明同时提交的关系操作对象集合。
10 | ///
11 | internal interface IInsertReferenceRelation
12 | {
13 | ///
14 | /// 插入数据时同时提交的关系数据。
15 | ///
16 | ICollection Relations { get; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Providers/SqlServerAccessProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Providers
5 | {
6 | ///
7 | /// SQL Server 数据访问提供程序。
8 | ///
9 | internal class SqlServerAccessProvider : DbAccessProvider
10 | {
11 | ///
12 | public override string ProviderName => "System.Data.SqlClient";
13 | ///
14 | public override EExecutionMode ExecutionMode => EExecutionMode.MergeOperations;
15 | }
16 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Providers/DB2AccessProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Providers
5 | {
6 | using System;
7 | ///
8 | /// 访问Nuget组件:IBM.Data.DB2
9 | ///
10 | internal class DB2AccessProvider : DbAccessProvider
11 | {
12 | ///
13 | public override string ProviderName => "IBM.Data.DB2";
14 | ///
15 | public override EExecutionMode ExecutionMode => throw new NotImplementedException();
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Expressions/IDbExpandUnitExpression.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Expressions
5 | {
6 | using System.Collections.Generic;
7 | ///
8 | /// 可展开的数据单元表达式,实现该接口的数据单元可以显示声明获取复
9 | /// 杂对象或集合属性,常用于数据查核的 Include 操作。
10 | ///
11 | public interface IDbExpandUnitExpression : IDbUnitTypeExpression
12 | {
13 | ///
14 | /// 需要展开属性表达式集合。
15 | ///
16 | IList ExpandItems { get; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Metadatas/MemberKind.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Metadatas
5 | {
6 | ///
7 | /// 成员种类。
8 | ///
9 | public enum MemberKind
10 | {
11 | ///
12 | /// 基元值成员。
13 | ///
14 | Primary = 1,
15 | ///
16 | /// 对象成员。
17 | ///
18 | Object = 2,
19 | ///
20 | /// 集合成员。
21 | ///
22 | Collection = 3
23 | }
24 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Operates/IConcurrencyCheckOperate.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Operates
5 | {
6 | ///
7 | /// 并发检查操作接口。
8 | ///
9 | internal interface IConcurrencyCheckOperate : IDbSplitObjectsOperate
10 | {
11 | ///
12 | /// 当前操作是否需要并发检查。
13 | ///
14 | bool NeedCheck { get; }
15 | ///
16 | /// 用于并发检查的期望数量。
17 | ///
18 | int ExpectCount { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Generators/ECommitValueType.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Generators
5 | {
6 | ///
7 | /// 值类型。
8 | ///
9 | public enum ECommitValueType
10 | {
11 | ///
12 | /// 常量。
13 | ///
14 | Constant = 0,
15 | ///
16 | /// 数据库生成。
17 | ///
18 | Database = 1,
19 | ///
20 | /// 表达式创建。
21 | ///
22 | Expression = 2
23 | }
24 | }
--------------------------------------------------------------------------------
/src/Caredev.Mego/Resolve/Outputs/IMultiOutput.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) CarefreeXT and Caredev Studios. All rights reserved.
2 | // Licensed under the GNU Lesser General Public License v3.0.
3 | // See License.txt in the project root for license information.
4 | namespace Caredev.Mego.Resolve.Outputs
5 | {
6 | using System.Collections.Generic;
7 | using System.Data.Common;
8 | ///
9 | /// 多值输出对象接口。
10 | ///
11 | public interface IMultiOutput
12 | {
13 | ///
14 | /// 获取执行结果。
15 | ///
16 | /// 数据读取器。
17 | /// 执行结果。
18 | IEnumerable