
6 changed files with 430 additions and 308 deletions
-
346Bson/Bson.csproj
-
24Bson/DefaultSerializer/BsonClassMap.cs
-
25Bson/DefaultSerializer/Conventions/ConventionProfile.cs
-
30Bson/DefaultSerializer/Conventions/ElementNameConventions.cs
-
259BsonUnitTests/BsonUnitTests.csproj
-
54BsonUnitTests/DefaultSerializer/Conventions/ElementNameConventionsTests.cs
@ -1,179 +1,181 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProductVersion>9.0.30729</ProductVersion> |
|||
<SchemaVersion>2.0</SchemaVersion> |
|||
<ProjectGuid>{0E9A3A2A-49CD-4F6C-847C-DC79B4B65CE6}</ProjectGuid> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>MongoDB.Bson</RootNamespace> |
|||
<AssemblyName>MongoDB.Bson</AssemblyName> |
|||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<FileUpgradeFlags> |
|||
</FileUpgradeFlags> |
|||
<OldToolsVersion>3.5</OldToolsVersion> |
|||
<UpgradeBackupLocation /> |
|||
<PublishUrl>publish\</PublishUrl> |
|||
<Install>true</Install> |
|||
<InstallFrom>Disk</InstallFrom> |
|||
<UpdateEnabled>false</UpdateEnabled> |
|||
<UpdateMode>Foreground</UpdateMode> |
|||
<UpdateInterval>7</UpdateInterval> |
|||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> |
|||
<UpdatePeriodically>false</UpdatePeriodically> |
|||
<UpdateRequired>false</UpdateRequired> |
|||
<MapFileExtensions>true</MapFileExtensions> |
|||
<ApplicationRevision>0</ApplicationRevision> |
|||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> |
|||
<IsWebBootstrapper>false</IsWebBootstrapper> |
|||
<UseApplicationTrust>false</UseApplicationTrust> |
|||
<BootstrapperEnabled>true</BootstrapperEnabled> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.ServiceModel"> |
|||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Xml.Linq"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Data.DataSetExtensions"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Xml" /> |
|||
<Reference Include="WindowsBase"> |
|||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|||
</Reference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="BsonExtensionMethods.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonIdGenerators.cs" /> |
|||
<Compile Include="Exceptions\BsonInternalException.cs" /> |
|||
<Compile Include="Exceptions\BsonSerializationException.cs" /> |
|||
<Compile Include="ObjectModel\IConvertibleToBsonDocument.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonDefaultValueAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonDiscriminatorAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonElementAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonIdAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonIgnoreAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonIgnoreExtraElementsAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonIgnoreIfNullAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonKnownTypeAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonRequiredAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonUseCompactRepresentationAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonClassMap.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonClassMapSerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonPropertyMap.cs" /> |
|||
<Compile Include="ObjectModel\BsonArray.cs" /> |
|||
<Compile Include="IO\BsonBinaryReader.cs" /> |
|||
<Compile Include="IO\BsonBinaryReaderSettings.cs" /> |
|||
<Compile Include="BsonDefaults.cs" /> |
|||
<Compile Include="IO\BsonJsonOutputMode.cs" /> |
|||
<Compile Include="IO\BsonJsonWriter.cs" /> |
|||
<Compile Include="IO\BsonJsonWriterSettings.cs" /> |
|||
<Compile Include="ObjectModel\BsonBoolean.cs" /> |
|||
<Compile Include="ObjectModel\BsonDateTime.cs" /> |
|||
<Compile Include="ObjectModel\BsonDocumentWrapper.cs" /> |
|||
<Compile Include="ObjectModel\BsonInt64.cs" /> |
|||
<Compile Include="ObjectModel\BsonNull.cs" /> |
|||
<Compile Include="ObjectModel\BsonBinaryData.cs" /> |
|||
<Compile Include="ObjectModel\BsonJavaScriptWithScope.cs" /> |
|||
<Compile Include="IO\BsonReader.cs" /> |
|||
<Compile Include="IO\BsonReadState.cs" /> |
|||
<Compile Include="Serialization\BsonSerializer.cs" /> |
|||
<Compile Include="ObjectModel\ObjectId.cs" /> |
|||
<Compile Include="ObjectModel\BsonTypeMapper.cs" /> |
|||
<Compile Include="BsonUtils.cs" /> |
|||
<Compile Include="ObjectModel\BsonDouble.cs" /> |
|||
<Compile Include="ObjectModel\BsonInt32.cs" /> |
|||
<Compile Include="ObjectModel\BsonString.cs" /> |
|||
<Compile Include="ObjectModel\BsonValue.cs" /> |
|||
<Compile Include="IO\BsonWriter.cs" /> |
|||
<Compile Include="IO\BsonBinaryWriterSettings.cs" /> |
|||
<Compile Include="IO\BsonWriteState.cs" /> |
|||
<Compile Include="ObjectModel\BsonJavaScript.cs" /> |
|||
<Compile Include="ObjectModel\BsonTimestamp.cs" /> |
|||
<Compile Include="BsonConstants.cs" /> |
|||
<Compile Include="ObjectModel\BsonBinarySubType.cs" /> |
|||
<Compile Include="ObjectModel\BsonType.cs" /> |
|||
<Compile Include="Exceptions\BsonException.cs" /> |
|||
<Compile Include="ObjectModel\BsonSymbolTable.cs" /> |
|||
<Compile Include="IO\BsonBinaryWriter.cs" /> |
|||
<Compile Include="ObjectModel\BsonDocument.cs" /> |
|||
<Compile Include="ObjectModel\BsonElement.cs" /> |
|||
<Compile Include="ObjectModel\BsonObjectId.cs" /> |
|||
<Compile Include="ObjectModel\BsonRegularExpression.cs" /> |
|||
<Compile Include="ObjectModel\BsonSymbol.cs" /> |
|||
<Compile Include="ObjectModel\BsonMaxKey.cs" /> |
|||
<Compile Include="ObjectModel\BsonMinKey.cs" /> |
|||
<Compile Include="IO\BsonBuffer.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonDefaultSerializationProvider.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonBaseSerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\GeneralEnumSerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\GenericArraySerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonIBsonSerializableSerializer.cs" /> |
|||
<Compile Include="Serialization\IBsonIdGenerator.cs" /> |
|||
<Compile Include="Serialization\IBsonSerializable.cs" /> |
|||
<Compile Include="Serialization\IBsonSerializer.cs" /> |
|||
<Compile Include="IO\BsonJsonWriterContext.cs" /> |
|||
<Compile Include="IO\BsonBinaryReaderContext.cs" /> |
|||
<Compile Include="IO\BsonBinaryWriterContext.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonValueSerializers.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\GenericEnumerableSerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\NetPrimitiveSerializers.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonPrimitiveSerializers.cs" /> |
|||
<Compile Include="Serialization\IBsonSerializationProvider.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5"> |
|||
<Visible>False</Visible> |
|||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> |
|||
<Install>false</Install> |
|||
</BootstrapperPackage> |
|||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> |
|||
<Visible>False</Visible> |
|||
<ProductName>.NET Framework 3.5 SP1</ProductName> |
|||
<Install>true</Install> |
|||
</BootstrapperPackage> |
|||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> |
|||
<Visible>False</Visible> |
|||
<ProductName>Windows Installer 3.1</ProductName> |
|||
<Install>true</Install> |
|||
</BootstrapperPackage> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProductVersion>9.0.30729</ProductVersion> |
|||
<SchemaVersion>2.0</SchemaVersion> |
|||
<ProjectGuid>{0E9A3A2A-49CD-4F6C-847C-DC79B4B65CE6}</ProjectGuid> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>MongoDB.Bson</RootNamespace> |
|||
<AssemblyName>MongoDB.Bson</AssemblyName> |
|||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<FileUpgradeFlags> |
|||
</FileUpgradeFlags> |
|||
<OldToolsVersion>3.5</OldToolsVersion> |
|||
<UpgradeBackupLocation /> |
|||
<PublishUrl>publish\</PublishUrl> |
|||
<Install>true</Install> |
|||
<InstallFrom>Disk</InstallFrom> |
|||
<UpdateEnabled>false</UpdateEnabled> |
|||
<UpdateMode>Foreground</UpdateMode> |
|||
<UpdateInterval>7</UpdateInterval> |
|||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> |
|||
<UpdatePeriodically>false</UpdatePeriodically> |
|||
<UpdateRequired>false</UpdateRequired> |
|||
<MapFileExtensions>true</MapFileExtensions> |
|||
<ApplicationRevision>0</ApplicationRevision> |
|||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> |
|||
<IsWebBootstrapper>false</IsWebBootstrapper> |
|||
<UseApplicationTrust>false</UseApplicationTrust> |
|||
<BootstrapperEnabled>true</BootstrapperEnabled> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.ServiceModel"> |
|||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Xml.Linq"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Data.DataSetExtensions"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Xml" /> |
|||
<Reference Include="WindowsBase"> |
|||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|||
</Reference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="BsonExtensionMethods.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonIdGenerators.cs" /> |
|||
<Compile Include="DefaultSerializer\Conventions\ConventionProfile.cs" /> |
|||
<Compile Include="DefaultSerializer\Conventions\ElementNameConventions.cs" /> |
|||
<Compile Include="Exceptions\BsonInternalException.cs" /> |
|||
<Compile Include="Exceptions\BsonSerializationException.cs" /> |
|||
<Compile Include="ObjectModel\IConvertibleToBsonDocument.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonDefaultValueAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonDiscriminatorAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonElementAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonIdAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonIgnoreAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonIgnoreExtraElementsAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonIgnoreIfNullAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonKnownTypeAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonRequiredAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonUseCompactRepresentationAttribute.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonClassMap.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonClassMapSerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonPropertyMap.cs" /> |
|||
<Compile Include="ObjectModel\BsonArray.cs" /> |
|||
<Compile Include="IO\BsonBinaryReader.cs" /> |
|||
<Compile Include="IO\BsonBinaryReaderSettings.cs" /> |
|||
<Compile Include="BsonDefaults.cs" /> |
|||
<Compile Include="IO\BsonJsonOutputMode.cs" /> |
|||
<Compile Include="IO\BsonJsonWriter.cs" /> |
|||
<Compile Include="IO\BsonJsonWriterSettings.cs" /> |
|||
<Compile Include="ObjectModel\BsonBoolean.cs" /> |
|||
<Compile Include="ObjectModel\BsonDateTime.cs" /> |
|||
<Compile Include="ObjectModel\BsonDocumentWrapper.cs" /> |
|||
<Compile Include="ObjectModel\BsonInt64.cs" /> |
|||
<Compile Include="ObjectModel\BsonNull.cs" /> |
|||
<Compile Include="ObjectModel\BsonBinaryData.cs" /> |
|||
<Compile Include="ObjectModel\BsonJavaScriptWithScope.cs" /> |
|||
<Compile Include="IO\BsonReader.cs" /> |
|||
<Compile Include="IO\BsonReadState.cs" /> |
|||
<Compile Include="Serialization\BsonSerializer.cs" /> |
|||
<Compile Include="ObjectModel\ObjectId.cs" /> |
|||
<Compile Include="ObjectModel\BsonTypeMapper.cs" /> |
|||
<Compile Include="BsonUtils.cs" /> |
|||
<Compile Include="ObjectModel\BsonDouble.cs" /> |
|||
<Compile Include="ObjectModel\BsonInt32.cs" /> |
|||
<Compile Include="ObjectModel\BsonString.cs" /> |
|||
<Compile Include="ObjectModel\BsonValue.cs" /> |
|||
<Compile Include="IO\BsonWriter.cs" /> |
|||
<Compile Include="IO\BsonBinaryWriterSettings.cs" /> |
|||
<Compile Include="IO\BsonWriteState.cs" /> |
|||
<Compile Include="ObjectModel\BsonJavaScript.cs" /> |
|||
<Compile Include="ObjectModel\BsonTimestamp.cs" /> |
|||
<Compile Include="BsonConstants.cs" /> |
|||
<Compile Include="ObjectModel\BsonBinarySubType.cs" /> |
|||
<Compile Include="ObjectModel\BsonType.cs" /> |
|||
<Compile Include="Exceptions\BsonException.cs" /> |
|||
<Compile Include="ObjectModel\BsonSymbolTable.cs" /> |
|||
<Compile Include="IO\BsonBinaryWriter.cs" /> |
|||
<Compile Include="ObjectModel\BsonDocument.cs" /> |
|||
<Compile Include="ObjectModel\BsonElement.cs" /> |
|||
<Compile Include="ObjectModel\BsonObjectId.cs" /> |
|||
<Compile Include="ObjectModel\BsonRegularExpression.cs" /> |
|||
<Compile Include="ObjectModel\BsonSymbol.cs" /> |
|||
<Compile Include="ObjectModel\BsonMaxKey.cs" /> |
|||
<Compile Include="ObjectModel\BsonMinKey.cs" /> |
|||
<Compile Include="IO\BsonBuffer.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonDefaultSerializationProvider.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonBaseSerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\GeneralEnumSerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\GenericArraySerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonIBsonSerializableSerializer.cs" /> |
|||
<Compile Include="Serialization\IBsonIdGenerator.cs" /> |
|||
<Compile Include="Serialization\IBsonSerializable.cs" /> |
|||
<Compile Include="Serialization\IBsonSerializer.cs" /> |
|||
<Compile Include="IO\BsonJsonWriterContext.cs" /> |
|||
<Compile Include="IO\BsonBinaryReaderContext.cs" /> |
|||
<Compile Include="IO\BsonBinaryWriterContext.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonValueSerializers.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\GenericEnumerableSerializer.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\NetPrimitiveSerializers.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonPrimitiveSerializers.cs" /> |
|||
<Compile Include="Serialization\IBsonSerializationProvider.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5"> |
|||
<Visible>False</Visible> |
|||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> |
|||
<Install>false</Install> |
|||
</BootstrapperPackage> |
|||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> |
|||
<Visible>False</Visible> |
|||
<ProductName>.NET Framework 3.5 SP1</ProductName> |
|||
<Install>true</Install> |
|||
</BootstrapperPackage> |
|||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> |
|||
<Visible>False</Visible> |
|||
<ProductName>Windows Installer 3.1</ProductName> |
|||
<Install>true</Install> |
|||
</BootstrapperPackage> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
|||
Other similar extension points exist, see Microsoft.Common.targets. |
|||
<Target Name="BeforeBuild"> |
|||
</Target> |
|||
<Target Name="AfterBuild"> |
|||
</Target> |
|||
--> |
|||
--> |
|||
</Project> |
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
|
|||
namespace MongoDB.Bson.DefaultSerializer.Conventions |
|||
{ |
|||
public sealed class ConventionProfile { |
|||
public static ConventionProfile Default { get; set; } |
|||
|
|||
public IElementNameConvention ElementNameConvention { get; private set; } |
|||
|
|||
static ConventionProfile() |
|||
{ |
|||
Default = new ConventionProfile() |
|||
.SetElementNameConvention(new MemberNameElementNameConvention()); |
|||
} |
|||
|
|||
public ConventionProfile SetElementNameConvention(IElementNameConvention convention) |
|||
{ |
|||
ElementNameConvention = convention; |
|||
return this; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Reflection; |
|||
|
|||
namespace MongoDB.Bson.DefaultSerializer.Conventions |
|||
{ |
|||
public interface IElementNameConvention { |
|||
string GetElementName(MemberInfo member); |
|||
} |
|||
|
|||
public class MemberNameElementNameConvention : IElementNameConvention { |
|||
public string GetElementName( |
|||
MemberInfo member |
|||
) { |
|||
return member.Name; |
|||
} |
|||
} |
|||
|
|||
public class CamelCaseElementNameConvention : IElementNameConvention { |
|||
public string GetElementName( |
|||
MemberInfo member |
|||
) { |
|||
string name = member.Name; |
|||
return Char.ToLowerInvariant(name[0]) + name.Substring(1); |
|||
} |
|||
} |
|||
|
|||
} |
@ -1,136 +1,137 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProductVersion>9.0.30729</ProductVersion> |
|||
<SchemaVersion>2.0</SchemaVersion> |
|||
<ProjectGuid>{10A5FAC2-E26F-4726-B888-26D5B849F805}</ProjectGuid> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>MongoDB.BsonUnitTests</RootNamespace> |
|||
<AssemblyName>MongoDB.BsonUnitTests</AssemblyName> |
|||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<FileUpgradeFlags> |
|||
</FileUpgradeFlags> |
|||
<OldToolsVersion>3.5</OldToolsVersion> |
|||
<UpgradeBackupLocation /> |
|||
<PublishUrl>publish\</PublishUrl> |
|||
<Install>true</Install> |
|||
<InstallFrom>Disk</InstallFrom> |
|||
<UpdateEnabled>false</UpdateEnabled> |
|||
<UpdateMode>Foreground</UpdateMode> |
|||
<UpdateInterval>7</UpdateInterval> |
|||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> |
|||
<UpdatePeriodically>false</UpdatePeriodically> |
|||
<UpdateRequired>false</UpdateRequired> |
|||
<MapFileExtensions>true</MapFileExtensions> |
|||
<ApplicationRevision>0</ApplicationRevision> |
|||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> |
|||
<IsWebBootstrapper>false</IsWebBootstrapper> |
|||
<UseApplicationTrust>false</UseApplicationTrust> |
|||
<BootstrapperEnabled>true</BootstrapperEnabled> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="nunit.framework, Version=2.5.7.10213, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> |
|||
<SpecificVersion>False</SpecificVersion> |
|||
<HintPath>..\dependencies\NUnit\lib\nunit.framework.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Runtime.Serialization"> |
|||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Xml.Linq"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Data.DataSetExtensions"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Xml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="DefaultSerializer\BsonClassMapTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializeFlagsTests.cs" /> |
|||
<Compile Include="IO\BsonBufferValueStraddlesChunksTests.cs" /> |
|||
<Compile Include="Jira\CSharp71Tests.cs" /> |
|||
<Compile Include="Jira\CSharp74Tests.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonAttributeTests.cs" /> |
|||
<Compile Include="Jira\CSharp78Tests.cs" /> |
|||
<Compile Include="Jira\CSharp81Tests.cs" /> |
|||
<Compile Include="ObjectModel\BsonDocumentTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonElementTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonEqualsTests.cs" /> |
|||
<Compile Include="IO\BsonJsonWriterTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonObjectIdTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonValueTests.cs" /> |
|||
<Compile Include="ObjectModel\ObjectIdTests.cs" /> |
|||
<Compile Include="IO\BsonReaderTests.cs" /> |
|||
<Compile Include="IO\BsonRoundTripTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonValueCompareToTests.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonDefaultSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializeArrayTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializeEnumTests.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\GenericEnumerableSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\NetPrimitiveSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializePolymorphicClassTests.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonValueSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonPrimitiveSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializeInterfaceTests.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Bson\Bson.csproj"> |
|||
<Project>{0E9A3A2A-49CD-4F6C-847C-DC79B4B65CE6}</Project> |
|||
<Name>Bson</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5"> |
|||
<Visible>False</Visible> |
|||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> |
|||
<Install>false</Install> |
|||
</BootstrapperPackage> |
|||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> |
|||
<Visible>False</Visible> |
|||
<ProductName>.NET Framework 3.5 SP1</ProductName> |
|||
<Install>true</Install> |
|||
</BootstrapperPackage> |
|||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> |
|||
<Visible>False</Visible> |
|||
<ProductName>Windows Installer 3.1</ProductName> |
|||
<Install>true</Install> |
|||
</BootstrapperPackage> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProductVersion>9.0.30729</ProductVersion> |
|||
<SchemaVersion>2.0</SchemaVersion> |
|||
<ProjectGuid>{10A5FAC2-E26F-4726-B888-26D5B849F805}</ProjectGuid> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>MongoDB.BsonUnitTests</RootNamespace> |
|||
<AssemblyName>MongoDB.BsonUnitTests</AssemblyName> |
|||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<FileUpgradeFlags> |
|||
</FileUpgradeFlags> |
|||
<OldToolsVersion>3.5</OldToolsVersion> |
|||
<UpgradeBackupLocation /> |
|||
<PublishUrl>publish\</PublishUrl> |
|||
<Install>true</Install> |
|||
<InstallFrom>Disk</InstallFrom> |
|||
<UpdateEnabled>false</UpdateEnabled> |
|||
<UpdateMode>Foreground</UpdateMode> |
|||
<UpdateInterval>7</UpdateInterval> |
|||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> |
|||
<UpdatePeriodically>false</UpdatePeriodically> |
|||
<UpdateRequired>false</UpdateRequired> |
|||
<MapFileExtensions>true</MapFileExtensions> |
|||
<ApplicationRevision>0</ApplicationRevision> |
|||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> |
|||
<IsWebBootstrapper>false</IsWebBootstrapper> |
|||
<UseApplicationTrust>false</UseApplicationTrust> |
|||
<BootstrapperEnabled>true</BootstrapperEnabled> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="nunit.framework, Version=2.5.7.10213, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> |
|||
<SpecificVersion>False</SpecificVersion> |
|||
<HintPath>..\dependencies\NUnit\lib\nunit.framework.dll</HintPath> |
|||
</Reference> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Runtime.Serialization"> |
|||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Xml.Linq"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Data.DataSetExtensions"> |
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
|||
</Reference> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Xml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="DefaultSerializer\BsonClassMapTests.cs" /> |
|||
<Compile Include="DefaultSerializer\Conventions\ElementNameConventionsTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializeFlagsTests.cs" /> |
|||
<Compile Include="IO\BsonBufferValueStraddlesChunksTests.cs" /> |
|||
<Compile Include="Jira\CSharp71Tests.cs" /> |
|||
<Compile Include="Jira\CSharp74Tests.cs" /> |
|||
<Compile Include="DefaultSerializer\Attributes\BsonAttributeTests.cs" /> |
|||
<Compile Include="Jira\CSharp78Tests.cs" /> |
|||
<Compile Include="Jira\CSharp81Tests.cs" /> |
|||
<Compile Include="ObjectModel\BsonDocumentTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonElementTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonEqualsTests.cs" /> |
|||
<Compile Include="IO\BsonJsonWriterTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonObjectIdTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonValueTests.cs" /> |
|||
<Compile Include="ObjectModel\ObjectIdTests.cs" /> |
|||
<Compile Include="IO\BsonReaderTests.cs" /> |
|||
<Compile Include="IO\BsonRoundTripTests.cs" /> |
|||
<Compile Include="ObjectModel\BsonValueCompareToTests.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="DefaultSerializer\BsonDefaultSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializeArrayTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializeEnumTests.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\GenericEnumerableSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\NetPrimitiveSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializePolymorphicClassTests.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonValueSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\Serializers\BsonPrimitiveSerializerTests.cs" /> |
|||
<Compile Include="DefaultSerializer\SerializeInterfaceTests.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Bson\Bson.csproj"> |
|||
<Project>{0E9A3A2A-49CD-4F6C-847C-DC79B4B65CE6}</Project> |
|||
<Name>Bson</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5"> |
|||
<Visible>False</Visible> |
|||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> |
|||
<Install>false</Install> |
|||
</BootstrapperPackage> |
|||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> |
|||
<Visible>False</Visible> |
|||
<ProductName>.NET Framework 3.5 SP1</ProductName> |
|||
<Install>true</Install> |
|||
</BootstrapperPackage> |
|||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> |
|||
<Visible>False</Visible> |
|||
<ProductName>Windows Installer 3.1</ProductName> |
|||
<Install>true</Install> |
|||
</BootstrapperPackage> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
|||
Other similar extension points exist, see Microsoft.Common.targets. |
|||
<Target Name="BeforeBuild"> |
|||
</Target> |
|||
<Target Name="AfterBuild"> |
|||
</Target> |
|||
--> |
|||
--> |
|||
</Project> |
@ -0,0 +1,54 @@ |
|||
/* Copyright 2010 10gen Inc. |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using NUnit.Framework; |
|||
|
|||
using MongoDB.Bson.DefaultSerializer.Conventions; |
|||
|
|||
namespace MongoDB.BsonUnitTests.DefaultSerializer.Conventions |
|||
{ |
|||
[TestFixture] |
|||
public class ElementNameConventionsTests { |
|||
private class TestClass { |
|||
public string FirstName { get; set; } |
|||
public int Age { get; set; } |
|||
public string _DumbName { get; set; } |
|||
public string lowerCase { get; set; } |
|||
} |
|||
|
|||
[Test] |
|||
public void TestMemberNameElementNameConvention() { |
|||
var convention = new MemberNameElementNameConvention(); |
|||
Assert.AreEqual("FirstName", convention.GetElementName(typeof(TestClass).GetProperty("FirstName"))); |
|||
Assert.AreEqual("Age", convention.GetElementName(typeof(TestClass).GetProperty("Age"))); |
|||
Assert.AreEqual("_DumbName", convention.GetElementName(typeof(TestClass).GetProperty("_DumbName"))); |
|||
Assert.AreEqual("lowerCase", convention.GetElementName(typeof(TestClass).GetProperty("lowerCase"))); |
|||
} |
|||
|
|||
[Test] |
|||
public void TestCamelCaseElementNameConvention() { |
|||
var convention = new CamelCaseElementNameConvention(); |
|||
Assert.AreEqual("firstName", convention.GetElementName(typeof(TestClass).GetProperty("FirstName"))); |
|||
Assert.AreEqual("age", convention.GetElementName(typeof(TestClass).GetProperty("Age"))); |
|||
Assert.AreEqual("_DumbName", convention.GetElementName(typeof(TestClass).GetProperty("_DumbName"))); |
|||
Assert.AreEqual("lowerCase", convention.GetElementName(typeof(TestClass).GetProperty("lowerCase"))); |
|||
} |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue