This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
// Setup Mapper config | |
var config = new MapperConfiguration(c => | |
{ | |
c.DisableConstructorMapping(); | |
c.CreateMap<RoleDTO, Role>(); | |
c.CreateMap<UserDTO, User>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
Mapper.Initialize(cfg => | |
{ | |
cfg.CreateMap<IBaseUserDto, IBaseUserEntity>() | |
.ForMember(d=>d.Name, opt => opt.Ignore()); | |
cfg.CreateMap(typeof(BaseUserDto<>), typeof(BaseUserEntity<>)); | |
cfg.CreateMap(typeof(ConcreteUserDto), typeof(ConcreteUserEntity)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Result StackTrace: | |
at System.Collections.Generic.SortedSet`1..ctor(IEnumerable`1 collection, IComparer`1 comparer) | |
at NuGet.Commands.UnresolvedMessages.<GetSourceInfoForIdAsync>d__6.MoveNext() | |
--- End of stack trace from previous location where exception was thrown --- | |
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) | |
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) | |
at NuGet.Commands.UnresolvedMessages.<GetSourceInfosForIdAsync>d__5.MoveNext() | |
--- End of stack trace from previous location where exception was thrown --- | |
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) | |
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
DirectoryLocker.Create(@"C:\X"); | |
DirectoryLocker.Create(@"C:\X"); | |
} | |
public static class DirectoryLocker | |
{ | |
private static ConcurrentDictionary<string, FileStream> _lockFiles = new ConcurrentDictionary<string, FileStream>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
var config = new MapperConfiguration(cfg => | |
{ | |
//cfg.CreateMissingTypeMaps = false; | |
cfg.CreateMap<DTO_Object, EntityClass>().ForMember(s => s.DynamicFields, | |
o => o.MapFrom(s => s.DynamicFields.Select(m => m.Id))); | |
}); | |
config.AssertConfigurationIsValid(); | |
var mapper = config.CreateMapper(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main() | |
{ | |
Mapper.Initialize(cfg=> | |
{ | |
cfg.CreateMap<Player, PlayerDto>() | |
.ForMember(d=>d.TeamIds, o=>o.MapFrom(s=>s.Teams.Select(t=>t.Id).ToList())) | |
.ForMember(d=>d.FullName, o=>o.MapFrom(s=>s.Name + " " +s.LastName)); | |
}); | |
Mapper.AssertConfigurationIsValid(); | |
using(var connection = new SQLiteConnection("data source=test")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var source = @"C:\Users\lucian.bargaoanu\AppData\Local\Packages\Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe\LocalState\{3e013fe7-2abf-493f-9d14-8c96bd350762}.txt"; | |
var afterBackSlashIndex = source.LastIndexOf('\\') + 1; | |
var s = new StringBuilder(source) | |
.Remove(afterBackSlashIndex, source.Length - afterBackSlashIndex) | |
.Replace('\\', '/'); | |
s.ToString().Dump(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Source | |
{ | |
public class Instance | |
{ | |
public Type Type { get; set; } | |
public object Definition { get; set; } | |
} | |
public sealed class Class : Instance | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
int Count = 20; | |
var sum = 0.0; | |
for(int i=0;i<Count;i++){ | |
var config = new MapperConfiguration(cfg => | |
{ | |
cfg.CreateMap<Entity1, EntityDTO1>().ReverseMap(); | |
cfg.CreateMap<Entity2, EntityDTO2>().ReverseMap(); | |
cfg.CreateMap<Entity3, EntityDTO3>().ReverseMap(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
Mapper.Initialize(cfg => | |
{ | |
cfg.CreateMap<Library, LibraryDto>(); | |
}); | |
using(var context = new TestContext()) | |
{ | |
context.Libraries.ProjectTo<LibraryDto>().Dump(); |