replaced FastReflection.dll with Fasterflect.dll to fix the race condition.

pull/4/head
kay.one 12 years ago
parent a0560da33d
commit bdcdc7c0f6

@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Marr.Data</RootNamespace>
<AssemblyName>Marr.Data</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
@ -21,6 +21,8 @@
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -40,8 +42,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FastReflection">
<HintPath>..\Libraries\FastReflection\FastReflection.dll</HintPath>
<Reference Include="Fasterflect, Version=2.1.3.0, Culture=neutral, PublicKeyToken=38d18473284c1ca7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\fasterflect.2.1.3\lib\net40\Fasterflect.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
@ -137,13 +140,7 @@
<Compile Include="SqlModesEnum.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="NuGet\Tools\" />
</ItemGroup>
<ItemGroup>
<Content Include="NuGet\NuGet.exe" />
</ItemGroup>
<ItemGroup>
<None Include="NuGet\marrdatamapper.nuspec" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
@ -154,6 +151,7 @@
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.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">

Binary file not shown.

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>MarrDataMapper</id>
<version>
3.17.4747.34302
</version>
<authors>Jordan Marr</authors>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Marr Data Mapper is a Linq enabled ORM that allows you to project views into complex object graphs. Contributors: Rick Schott, vitidev.</description>
<language>en-US</language>
<projectUrl>http://marrdatamapper.codeplex.com/</projectUrl>
<licenseUrl>http://marrdatamapper.codeplex.com/license</licenseUrl>
<tags>ORM data mapper fluent linq sql relational database DAL entity</tags>
</metadata>
<files>
<file src="bin\Release\*.dll" target="lib" />
</files>
</package>

@ -1,20 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using FastReflection;
using Fasterflect;
namespace Marr.Data.Reflection
{
public class CachedReflectionStrategy : IReflectionStrategy
{
private FastReflection.CachedReflector _reflector;
public CachedReflectionStrategy()
{
_reflector = new CachedReflector();
}
/// <summary>
/// Sets an entity field value by name to the passed in 'val'.
@ -29,24 +20,27 @@ namespace Marr.Data.Reflection
if (val == DBNull.Value)
{
if (member.MemberType == MemberTypes.Field)
_reflector.SetValue(member, entity, ReflectionHelper.GetDefaultValue((member as FieldInfo).FieldType));
{
entity.SetFieldValue(member.Name, ReflectionHelper.GetDefaultValue(((FieldInfo)member).FieldType));
}
else if (member.MemberType == MemberTypes.Property)
{
var pi = (member as PropertyInfo);
var pi = (PropertyInfo)member;
if (pi.CanWrite)
_reflector.SetValue(member, entity, ReflectionHelper.GetDefaultValue((member as PropertyInfo).PropertyType));
{
entity.SetPropertyValue(member.Name, ReflectionHelper.GetDefaultValue(((PropertyInfo)member).PropertyType));
}
}
}
else
{
if (member.MemberType == MemberTypes.Field)
_reflector.SetValue(member, entity, val);
else if (member.MemberType == MemberTypes.Property)
{
var pi = (member as PropertyInfo);
if (pi.CanWrite)
_reflector.SetValue(member, entity, val);
entity.SetFieldValue(member.Name, val);
}
else if (member.MemberType == MemberTypes.Property && ((PropertyInfo)member).CanWrite)
{
member.Set(entity, val);
}
}
}
@ -66,12 +60,12 @@ namespace Marr.Data.Reflection
if (member.MemberType == MemberTypes.Field)
{
return _reflector.GetValue(member, entity);
return entity.GetFieldValue(member.Name);
}
else if (member.MemberType == MemberTypes.Property)
if (member.MemberType == MemberTypes.Property && ((PropertyInfo)member).CanRead)
{
if ((member as PropertyInfo).CanRead)
return _reflector.GetValue(member, entity);
return entity.GetPropertyValue(member.Name);
}
throw new DataMappingException(string.Format("The DataMapper could not get the value for {0}.{1}.", entity.GetType().Name, fieldName));
@ -84,7 +78,7 @@ namespace Marr.Data.Reflection
/// <returns></returns>
public object CreateInstance(Type type)
{
return _reflector.Instantiate(type);
return type.CreateInstance();
}
}
}

@ -14,15 +14,7 @@ You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
/* *
* The FastReflection library was written by Renaud Bédard (renaud.bedard@gmail.com)
* http://theinstructionlimit.com/?p=76
* */
using FastReflection;
// ReSharper disable CheckNamespace
namespace Marr.Data

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="fasterflect" version="2.1.3" targetFramework="net40" />
</packages>

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
using Marr.Data;
@ -59,7 +60,7 @@ namespace NzbDrone.Core.Datastore
MapRepository.Instance.RegisterTypeConverter(typeof(Boolean), new BooleanIntConverter());
MapRepository.Instance.RegisterTypeConverter(typeof(Enum), new EnumIntConverter());
MapRepository.Instance.RegisterTypeConverter(typeof(QualityModel), new EmbeddedDocumentConverter());
MapRepository.Instance.RegisterTypeConverter(typeof(MediaCover.MediaCover), new EmbeddedDocumentConverter());
MapRepository.Instance.RegisterTypeConverter(typeof(List<MediaCover.MediaCover>), new EmbeddedDocumentConverter());
MapRepository.Instance.RegisterTypeConverter(typeof(Quality), new QualityIntConverter());
}
}

@ -50,6 +50,7 @@ namespace NzbDrone.Core.MetadataSource
var series = new Series();
series.TvDbId = show.tvdb_id;
series.TvRageId = show.tvrage_id;
series.ImdbId = show.imdb_id;
series.Title = show.title;
series.FirstAired = show.first_aired;
series.Overview = show.overview;

@ -23,6 +23,9 @@ namespace NzbDrone.Core.Tv
}
public int TvDbId { get; set; }
public int TvRageId { get; set; }
public string ImdbId { get; set; }
public string Title { get; set; }
public string CleanTitle { get; set; }
public SeriesStatusType Status { get; set; }
@ -41,7 +44,7 @@ namespace NzbDrone.Core.Tv
public string Network { get; set; }
public DateTime? CustomStartDate { get; set; }
public bool UseSceneNumbering { get; set; }
public int TvRageId { get; set; }
public string TitleSlug { get; set; }
//Todo: This should be a double since there are timezones that aren't on a full hour offset

Loading…
Cancel
Save