Compare commits
1 Commits
master
...
dev-mapper
Author | SHA1 | Date |
---|---|---|
Harald Wolff | e786b4698f |
|
@ -6,8 +6,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.bson.tests", "ln.bson.te
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.bson.storage", "ln.bson.storage\ln.bson.storage.csproj", "{FEB2C12B-7A0F-468C-9063-980FC4A4B8BE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.collections", "..\ln.collections\ln.collections\ln.collections.csproj", "{168FA1B8-0C0D-4AAE-B026-F1A736027C03}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -26,9 +24,5 @@ Global
|
|||
{FEB2C12B-7A0F-468C-9063-980FC4A4B8BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FEB2C12B-7A0F-468C-9063-980FC4A4B8BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FEB2C12B-7A0F-468C-9063-980FC4A4B8BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{168FA1B8-0C0D-4AAE-B026-F1A736027C03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{168FA1B8-0C0D-4AAE-B026-F1A736027C03}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{168FA1B8-0C0D-4AAE-B026-F1A736027C03}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{168FA1B8-0C0D-4AAE-B026-F1A736027C03}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer /></s:String>
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=3cd064d7_002Df8a3_002D40a1_002D89aa_002Ddd0af673f188/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="Test_Indeces" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||
<TestAncestor>
|
||||
<TestId>NUnit3x::D8C856D0-BA32-47A4-A334-71C9A1C66B07::net5.0::ln.bson.tests.Tests.Test_Indeces</TestId>
|
||||
</TestAncestor>
|
||||
</SessionState></s:String></wpf:ResourceDictionary>
|
||||
</SessionState></s:String>
|
||||
</wpf:ResourceDictionary>
|
|
@ -2,9 +2,57 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using ln.bson.mapper;
|
||||
using ln.bson.mapper.mappings;
|
||||
|
||||
namespace ln.bson.storage
|
||||
{
|
||||
public class BsonFileMapper<T> : IEnumerable<T>, IDisposable
|
||||
{
|
||||
private BsonDocumentStorage _bsonDocumentStorage;
|
||||
private ClassStructMapping<T> _mapping;
|
||||
|
||||
public BsonFileMapper()
|
||||
:this(null)
|
||||
{ }
|
||||
|
||||
public BsonFileMapper(BsonDocumentStorageConfiguration documentStorageConfiguration)
|
||||
{
|
||||
if (!BsonMapper.DefaultInstance.TryGetMapping(typeof(T), out BsonMapping bsonMapping))
|
||||
throw new ApplicationException();
|
||||
|
||||
_mapping = bsonMapping as ClassStructMapping<T>;
|
||||
|
||||
documentStorageConfiguration ??=
|
||||
new BsonDocumentStorageConfiguration(String.Format("{0}.bson", typeof(T).Name));
|
||||
|
||||
_bsonDocumentStorage = new BsonDocumentStorage(documentStorageConfiguration);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
/*
|
||||
public class BsonFileMapper<T> : IEnumerable<T>,IDisposable
|
||||
{
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageVersion>1.0.1</PackageVersion>
|
||||
<PackageVersion>1.0.2</PackageVersion>
|
||||
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ln.collections\ln.collections\ln.collections.csproj" />
|
||||
<ProjectReference Include="..\ln.bson\ln.bson.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ln.bson" Version="1.0.1" />
|
||||
<PackageReference Include="ln.bson" Version="1.0.2" />
|
||||
<PackageReference Include="ln.collections" Version="0.1.8" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -98,6 +98,14 @@ namespace ln.bson
|
|||
return false;
|
||||
}
|
||||
|
||||
public BsonValue GetProperty(string propertyName) => GetProperty(propertyName, null);
|
||||
public BsonValue GetProperty(string propertyName, BsonValue defaultValue)
|
||||
{
|
||||
if (_values.TryGetValue(propertyName, out BsonValue bsonValue))
|
||||
return bsonValue;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public override bool TryGetMember(GetMemberBinder binder, out object? result)
|
||||
{
|
||||
if (_values.TryGetValue(binder.Name, out BsonValue bsonValue))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageVersion>1.0.1</PackageVersion>
|
||||
<PackageVersion>1.0.2</PackageVersion>
|
||||
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue