Skip to content

Commit dfc3f5e

Browse files
committed
Upgrading to .NET Framework 4.5
1 parent 516d095 commit dfc3f5e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1184
-1067
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics.Contracts;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace DataCommander.Foundation.Collections.IndexableCollection
8+
{
9+
/// <summary>
10+
///
11+
/// </summary>
12+
/// <typeparam name="T"></typeparam>
13+
public sealed class EnumerableIndex<T> : ICollectionIndex<T>
14+
{
15+
private String name;
16+
private IEnumerable<T> enumerable;
17+
18+
/// <summary>
19+
///
20+
/// </summary>
21+
/// <param name="name"></param>
22+
/// <param name="enumerable"></param>
23+
public EnumerableIndex(String name, IEnumerable<T> enumerable)
24+
{
25+
Contract.Requires(enumerable != null);
26+
27+
this.name = name;
28+
this.enumerable = enumerable;
29+
}
30+
31+
string ICollectionIndex<T>.Name
32+
{
33+
get
34+
{
35+
return this.name;
36+
}
37+
}
38+
39+
void ICollection<T>.Add(T item)
40+
{
41+
throw new NotImplementedException();
42+
}
43+
44+
void ICollection<T>.Clear()
45+
{
46+
throw new NotImplementedException();
47+
}
48+
49+
bool ICollection<T>.Contains(T item)
50+
{
51+
throw new NotImplementedException();
52+
}
53+
54+
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
55+
{
56+
throw new NotImplementedException();
57+
}
58+
59+
int ICollection<T>.Count
60+
{
61+
get { throw new NotImplementedException(); }
62+
}
63+
64+
bool ICollection<T>.IsReadOnly
65+
{
66+
get { throw new NotImplementedException(); }
67+
}
68+
69+
bool ICollection<T>.Remove(T item)
70+
{
71+
throw new NotImplementedException();
72+
}
73+
74+
IEnumerator<T> IEnumerable<T>.GetEnumerator()
75+
{
76+
throw new NotImplementedException();
77+
}
78+
79+
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
80+
{
81+
throw new NotImplementedException();
82+
}
83+
}
84+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics.Contracts;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace DataCommander.Foundation.Collections.IndexableCollection
8+
{
9+
/// <summary>
10+
///
11+
/// </summary>
12+
/// <typeparam name="TKey"></typeparam>
13+
/// <typeparam name="T"></typeparam>
14+
public sealed class LookupIndex<TKey, T> : ICollectionIndex<T>
15+
{
16+
private readonly String name;
17+
private readonly ILookup<TKey, T> lookup;
18+
19+
/// <summary>
20+
///
21+
/// </summary>
22+
/// <param name="name"></param>
23+
/// <param name="source"></param>
24+
/// <param name="keySelector"></param>
25+
public LookupIndex(
26+
String name,
27+
IEnumerable<T> source,
28+
Func<T, TKey> keySelector)
29+
{
30+
Contract.Requires(source != null);
31+
Contract.Requires(keySelector != null);
32+
33+
this.name = name;
34+
this.lookup = source.ToLookup(keySelector);
35+
}
36+
37+
/// <summary>
38+
///
39+
/// </summary>
40+
public ILookup<TKey, T> Lookup
41+
{
42+
get
43+
{
44+
return this.lookup;
45+
}
46+
}
47+
48+
string ICollectionIndex<T>.Name
49+
{
50+
get
51+
{
52+
return this.name;
53+
}
54+
}
55+
56+
void ICollection<T>.Add(T item)
57+
{
58+
throw new NotImplementedException();
59+
}
60+
61+
void ICollection<T>.Clear()
62+
{
63+
throw new NotImplementedException();
64+
}
65+
66+
bool ICollection<T>.Contains(T item)
67+
{
68+
throw new NotImplementedException();
69+
}
70+
71+
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
72+
{
73+
throw new NotImplementedException();
74+
}
75+
76+
int ICollection<T>.Count
77+
{
78+
get
79+
{
80+
throw new NotImplementedException();
81+
}
82+
}
83+
84+
bool ICollection<T>.IsReadOnly
85+
{
86+
get
87+
{
88+
throw new NotImplementedException();
89+
}
90+
}
91+
92+
bool ICollection<T>.Remove(T item)
93+
{
94+
throw new NotImplementedException();
95+
}
96+
97+
IEnumerator<T> IEnumerable<T>.GetEnumerator()
98+
{
99+
throw new NotImplementedException();
100+
}
101+
102+
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
103+
{
104+
throw new NotImplementedException();
105+
}
106+
}
107+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace Binarit.Foundation.Data.SqlClient
2+
{
3+
using System.Data;
4+
5+
/// <summary>
6+
///
7+
/// </summary>
8+
public interface IDbCommandBuilderHelper
9+
{
10+
/// <summary>
11+
///
12+
/// </summary>
13+
/// <param name="command"></param>
14+
void DeriveParameters(IDbCommand command);
15+
}
16+
}

DataCommander.Foundation/DataCommander.Foundation-4.0.csproj.user

Lines changed: 0 additions & 6 deletions
This file was deleted.

DataCommander.Foundation/DataCommander.Foundation-4.0.csproj renamed to DataCommander.Foundation/DataCommander.Foundation-4.5.csproj

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ApplicationIcon>
1212
<AssemblyKeyContainerName>
1313
</AssemblyKeyContainerName>
14-
<AssemblyName>DataCommander.Foundation-4.0</AssemblyName>
14+
<AssemblyName>DataCommander.Foundation-4.5</AssemblyName>
1515
<AssemblyOriginatorKeyFile>
1616
</AssemblyOriginatorKeyFile>
1717
<DefaultClientScript>JScript</DefaultClientScript>
@@ -37,7 +37,7 @@
3737
</SccAuxPath>
3838
<SccProvider>
3939
</SccProvider>
40-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
40+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
4141
<IsWebBootstrapper>false</IsWebBootstrapper>
4242
<PublishUrl>publish\</PublishUrl>
4343
<Install>true</Install>
@@ -53,7 +53,8 @@
5353
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
5454
<UseApplicationTrust>false</UseApplicationTrust>
5555
<BootstrapperEnabled>true</BootstrapperEnabled>
56-
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
56+
<TargetFrameworkProfile>
57+
</TargetFrameworkProfile>
5758
<CodeContractsAssemblyMode>1</CodeContractsAssemblyMode>
5859
</PropertyGroup>
5960
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -63,8 +64,8 @@
6364
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
6465
<ConfigurationOverrideFile>
6566
</ConfigurationOverrideFile>
66-
<DefineConstants>TRACE;DEBUG;FOUNDATION_4_0</DefineConstants>
67-
<DocumentationFile>bin\Debug\DataCommander.Foundation-4.0.xml</DocumentationFile>
67+
<DefineConstants>TRACE;DEBUG;FOUNDATION_4_5</DefineConstants>
68+
<DocumentationFile>bin\Debug\DataCommander.Foundation-4.5.xml</DocumentationFile>
6869
<DebugSymbols>true</DebugSymbols>
6970
<FileAlignment>4096</FileAlignment>
7071
<NoStdLib>false</NoStdLib>
@@ -111,6 +112,7 @@
111112
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
112113
<CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
113114
<CodeContractsDisjunctiveRequires>False</CodeContractsDisjunctiveRequires>
115+
<Prefer32Bit>false</Prefer32Bit>
114116
</PropertyGroup>
115117
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
116118
<OutputPath>bin\Release\</OutputPath>
@@ -119,7 +121,7 @@
119121
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
120122
<ConfigurationOverrideFile>
121123
</ConfigurationOverrideFile>
122-
<DefineConstants>TRACE;FOUNDATION_4_0</DefineConstants>
124+
<DefineConstants>TRACE;FOUNDATION_4_5</DefineConstants>
123125
<DocumentationFile>DataCommander.Foundation-4.0.xml</DocumentationFile>
124126
<DebugSymbols>true</DebugSymbols>
125127
<FileAlignment>4096</FileAlignment>
@@ -169,6 +171,7 @@
169171
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
170172
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
171173
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
174+
<Prefer32Bit>false</Prefer32Bit>
172175
</PropertyGroup>
173176
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'NDoc|AnyCPU' ">
174177
<OutputPath>bin\Doc\</OutputPath>
@@ -177,7 +180,7 @@
177180
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
178181
<ConfigurationOverrideFile>
179182
</ConfigurationOverrideFile>
180-
<DefineConstants>FOUNDATION_4_0</DefineConstants>
183+
<DefineConstants>FOUNDATION_4_5</DefineConstants>
181184
<DocumentationFile>DataCommander.Foundation-3.5.xml</DocumentationFile>
182185
<DebugSymbols>true</DebugSymbols>
183186
<FileAlignment>4096</FileAlignment>
@@ -192,11 +195,12 @@
192195
<DebugType>full</DebugType>
193196
<ErrorReport>prompt</ErrorReport>
194197
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
198+
<Prefer32Bit>false</Prefer32Bit>
195199
</PropertyGroup>
196200
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Test|AnyCPU' ">
197201
<DebugSymbols>true</DebugSymbols>
198202
<OutputPath>bin\Test\</OutputPath>
199-
<DefineConstants>TRACE;DEBUG;FOUNDATION_4_0;TEST</DefineConstants>
203+
<DefineConstants>TRACE;DEBUG;FOUNDATION_4_5;TEST</DefineConstants>
200204
<BaseAddress>285212672</BaseAddress>
201205
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
202206
<FileAlignment>4096</FileAlignment>
@@ -206,7 +210,7 @@
206210
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
207211
<ErrorReport>prompt</ErrorReport>
208212
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
209-
<DocumentationFile>bin\Test\DataCommander.Foundation-4.0.xml</DocumentationFile>
213+
<DocumentationFile>bin\Test\DataCommander.Foundation-4.5.xml</DocumentationFile>
210214
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
211215
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
212216
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
@@ -241,11 +245,12 @@
241245
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
242246
<CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
243247
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
248+
<Prefer32Bit>false</Prefer32Bit>
244249
</PropertyGroup>
245250
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ClientRelease|AnyCPU'">
246251
<DebugSymbols>true</DebugSymbols>
247252
<OutputPath>bin\ClientRelease\</OutputPath>
248-
<DefineConstants>TRACE;FOUNDATION_4_0</DefineConstants>
253+
<DefineConstants>TRACE;FOUNDATION_4_5</DefineConstants>
249254
<BaseAddress>285212672</BaseAddress>
250255
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
251256
<DocumentationFile>DataCommander.Foundation-4.0.xml</DocumentationFile>
@@ -264,6 +269,7 @@
264269
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
265270
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
266271
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
272+
<Prefer32Bit>false</Prefer32Bit>
267273
</PropertyGroup>
268274
<ItemGroup>
269275
<Reference Include="System">

DataCommander.Foundation/Linq/IDictionaryExtensions.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,31 @@ public static IDictionary<TKey, TValue> AsReadOnly<TKey, TValue>( this IDictiona
5353
return readOnlyDictionary;
5454
}
5555

56+
/// <summary>
57+
///
58+
/// </summary>
59+
/// <typeparam name="TKey"></typeparam>
60+
/// <typeparam name="TValue"></typeparam>
61+
/// <param name="dictionary"></param>
62+
/// <param name="key"></param>
63+
/// <param name="valueFactory"></param>
64+
/// <returns></returns>
65+
public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TKey, TValue> valueFactory)
66+
{
67+
Contract.Requires(dictionary != null);
68+
Contract.Requires(valueFactory != null);
69+
70+
TValue value;
71+
72+
if (!dictionary.TryGetValue(key, out value))
73+
{
74+
value = valueFactory(key);
75+
dictionary.Add(key, value);
76+
}
77+
78+
return value;
79+
}
80+
5681
/// <summary>
5782
///
5883
/// </summary>

0 commit comments

Comments
 (0)