/src/Otis.Tests/MappingPreparerDTO.cs
http://otis-lib.googlecode.com/ · C# · 70 lines · 61 code · 9 blank · 0 comment · 0 complexity · e4489f1fd95b29b1e8ba3362c0d7e0e9 MD5 · raw file
- using System;
- using System.Collections.Generic;
- using System.Text;
- using Otis.Tests.Entity;
-
- namespace Otis.Tests
- {
- [MapClass(typeof(User), Preparer = "Otis.Tests.Util.Convert")]
- public class MappingPreparerDTO_Duplicate
- {
- [Map("$Id")]
- public int Id;
-
- [MappingPreparer]
- public void Preparer(ref MappingPreparerDTO_Duplicate dto, ref User user)
- { }
- }
-
- [MapClass(typeof(User))]
- public class MappingPreparerDTO_NonPublic
- {
- [Map("$Id")]
- public int Id;
- [MappingPreparer]
- void Preparer(ref MappingPreparerDTO_NonPublic dto, ref User user) { }
- }
-
- [MapClass(typeof(User))]
- public class MappingPreparerDTO_InstancePreparer
- {
- [Map("$Id")]
- public int Id;
- public string FullName;
-
- [MappingPreparer]
- public void Preparer(ref MappingPreparerDTO_InstancePreparer dto, ref User user)
- {
- dto.FullName = "custom_mapping_InstancePreparer";
- }
- }
-
- [MapClass(typeof(User), Preparer = "Otis.Tests.MappingPreparerTestConverter.Convert")]
- public class MappingPreparerDTO_StaticPreparer
- {
- [Map("$Id")]
- public int Id;
- public string FullName;
- }
-
- [MapClass(typeof(User))]
- public class MappingPreparerDTO_CheckOrder
- {
- [Map("$Id")]
- public int Id;
-
- [MappingPreparer]
- public void Preparer(ref MappingPreparerDTO_CheckOrder dto, ref User user)
- {
- dto.Id = -1;
- }
- }
-
- public class MappingPreparerTestConverter
- {
- public static void Convert(ref MappingPreparerDTO_StaticPreparer dto, ref User user)
- {
- dto.FullName = "custom_mapping_StaticPreparer";
- }
- }
- }