forked from emersonsoares/FluentValidation.Net35
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Porting FluentValidation on .Net 3.5
- Loading branch information
1 parent
9cba444
commit 4e28b50
Showing
42 changed files
with
1,431 additions
and
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0"?> | ||
<Project> | ||
<PropertyGroup> | ||
<NoWarn>NU1701</NoWarn> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<FrameworkPathOverride Condition="'$(TargetFramework)|$(OS)' == 'net35|Windows_NT'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride> | ||
<FrameworkPathOverride Condition="'$(TargetFramework)|$(OS)' == 'net35|Unix'">$(MONO_DIR)/../lib/mono/2.0-api</FrameworkPathOverride> | ||
</PropertyGroup> | ||
</Project> |
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,5 +1,5 @@ | ||
{ | ||
"sdk": { | ||
"version": "2.2.100" | ||
"version": "2.2.204" | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/FluentValidation.Tests/Compatibility/DataAnnotations.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
| ||
#if NET35 | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace System.ComponentModel.DataAnnotations | ||
{ | ||
[System.AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] | ||
sealed class DisplayAttribute : Attribute | ||
{ | ||
public string Name { get; set; } | ||
public Type ResourceType { get; set; } | ||
} | ||
} | ||
#endif |
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#if NET35 | ||
using System.Reflection; | ||
|
||
namespace System.Collections.Generic | ||
{ | ||
// | ||
// Summary: | ||
// Represents a strongly-typed, read-only collection of elements. | ||
// | ||
// Type parameters: | ||
// T: | ||
// The type of the elements.This type parameter is covariant. That is, you can use | ||
// either the type you specified or any type that is more derived. For more information | ||
// about covariance and contravariance, see Covariance and Contravariance in Generics. | ||
//[TypeDependencyAttribute("System.SZArrayHelper")] | ||
public interface IReadOnlyCollection<T> : IEnumerable<T>, IEnumerable | ||
{ | ||
// | ||
// Summary: | ||
// Gets the number of elements in the collection. | ||
// | ||
// Returns: | ||
// The number of elements in the collection. | ||
int Count { get; } | ||
} | ||
|
||
// | ||
// Summary: | ||
// Represents a read-only collection of elements that can be accessed by index. | ||
// | ||
// Type parameters: | ||
// T: | ||
// The type of elements in the read-only list. This type parameter is covariant. | ||
// That is, you can use either the type you specified or any type that is more derived. | ||
// For more information about covariance and contravariance, see Covariance and | ||
// Contravariance in Generics. | ||
//[DefaultMember("Item")] | ||
//[TypeDependencyAttribute("System.SZArrayHelper")] | ||
public interface IReadOnlyList<T> : IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable | ||
{ | ||
// | ||
// Summary: | ||
// Gets the element at the specified index in the read-only list. | ||
// | ||
// Parameters: | ||
// index: | ||
// The zero-based index of the element to get. | ||
// | ||
// Returns: | ||
// The element at the specified index in the read-only list. | ||
T this[int index] { get; } | ||
} | ||
|
||
static class RealdOnlyExtension | ||
{ | ||
class RL<T>: ObjectModel.ReadOnlyCollection<T>, IReadOnlyList<T> | ||
{ | ||
public RL(IList<T> source):base(source) | ||
{ | ||
|
||
} | ||
} | ||
|
||
public static IReadOnlyList<T> AsReadOnlyEx<T>(this IList<T> source) | ||
{ | ||
return new RL<T>(source); | ||
} | ||
} | ||
} | ||
#endif |
13 changes: 13 additions & 0 deletions
13
src/FluentValidation.Tests/Compatibility/StringExtensions.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace System | ||
{ | ||
static class StringExtensions | ||
{ | ||
public static bool IsNullOrWhiteSpace(this string source) => | ||
#if NET35 | ||
string.IsNullOrEmpty(source) || source.Trim().Length == 0; | ||
#else | ||
string.IsNullOrWhiteSpace(source); | ||
#endif | ||
|
||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/FluentValidation.Tests/Compatibility/TypeExtensions.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#if NET35 | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace System | ||
{ | ||
static class TypeExtensions | ||
{ | ||
public static Type GetTypeInfo(this Type source) | ||
{ | ||
return source; | ||
} | ||
} | ||
} | ||
# endif |
Oops, something went wrong.