forked from black-goldfinch/simple-1c
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gusev_p
committed
Jun 28, 2016
1 parent
09617fc
commit 0873ee8
Showing
18 changed files
with
64 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
60 changes: 30 additions & 30 deletions
60
Simple1C/Impl/TypeMapper.cs → Simple1C/Impl/TypeRegistry.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using Simple1C.Impl.Helpers; | ||
|
||
namespace Simple1C.Impl | ||
{ | ||
internal class TypeMapper | ||
{ | ||
private readonly Dictionary<string, Type> typeMapping; | ||
|
||
public TypeMapper(Assembly assembly) | ||
{ | ||
typeMapping = assembly.GetTypes() | ||
.Where(x => x.IsClass || x.IsEnum) | ||
.Select(x => new | ||
{ | ||
typeName1C = ConfigurationName.GetOrNull(x), | ||
type = x | ||
}) | ||
.Where(x => x.typeName1C.HasValue) | ||
.ToDictionary(x => x.typeName1C.Value.Fullname, x => x.type); | ||
} | ||
|
||
public Type GetTypeOrNull(string configurationName) | ||
{ | ||
return typeMapping.GetOrDefault(configurationName); | ||
} | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using Simple1C.Impl.Helpers; | ||
|
||
namespace Simple1C.Impl | ||
{ | ||
internal class TypeRegistry | ||
{ | ||
private readonly Dictionary<string, Type> typeMapping; | ||
|
||
public TypeRegistry(Assembly assembly) | ||
{ | ||
typeMapping = assembly.GetTypes() | ||
.Where(x => x.IsClass || x.IsEnum) | ||
.Select(x => new | ||
{ | ||
typeName1C = ConfigurationName.GetOrNull(x), | ||
type = x | ||
}) | ||
.Where(x => x.typeName1C.HasValue) | ||
.ToDictionary(x => x.typeName1C.Value.Fullname, x => x.type); | ||
} | ||
|
||
public Type GetTypeOrNull(string configurationName) | ||
{ | ||
return typeMapping.GetOrDefault(configurationName); | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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