Skip to content

Commit 5abc663

Browse files
committed
update to v 0.7.0.0 - bug fix with unidirectional self referential entities + upgrade to latest nuget packages.
1 parent cd20335 commit 5abc663

File tree

21 files changed

+3026
-105
lines changed

21 files changed

+3026
-105
lines changed

Breeze.Sharp/Breeze.Sharp.csproj

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -118,40 +118,8 @@
118118
<Compile Include="Validators.cs" />
119119
<Compile Include="Validator.cs" />
120120
</ItemGroup>
121-
<ItemGroup>
122-
<Reference Include="Microsoft.Data.Edm">
123-
<HintPath>..\packages\Microsoft.Data.Edm.5.6.3\lib\portable-net45+wp8+win8+wpa\Microsoft.Data.Edm.dll</HintPath>
124-
</Reference>
125-
<Reference Include="Microsoft.Data.OData">
126-
<HintPath>..\packages\Microsoft.Data.OData.5.6.3\lib\portable-net45+wp8+win8+wpa\Microsoft.Data.OData.dll</HintPath>
127-
</Reference>
128-
<Reference Include="Microsoft.Data.Services.Client">
129-
<HintPath>..\packages\Microsoft.Data.Services.Client.5.6.3\lib\portable-net45+wp8+win8+wpa\Microsoft.Data.Services.Client.dll</HintPath>
130-
</Reference>
131-
<Reference Include="Newtonsoft.Json">
132-
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
133-
</Reference>
134-
<Reference Include="System.Net.Http">
135-
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
136-
</Reference>
137-
<Reference Include="System.Net.Http.Extensions">
138-
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
139-
</Reference>
140-
<Reference Include="System.Net.Http.Formatting">
141-
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\portable-wp8+netcore45+net45+wp81+wpa81\System.Net.Http.Formatting.dll</HintPath>
142-
</Reference>
143-
<Reference Include="System.Net.Http.Primitives">
144-
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
145-
</Reference>
146-
<Reference Include="System.Spatial">
147-
<HintPath>..\packages\System.Spatial.5.6.3\lib\portable-net45+wp8+win8+wpa\System.Spatial.dll</HintPath>
148-
</Reference>
149-
</ItemGroup>
150121
<ItemGroup>
151122
<None Include="app.config" />
152-
<None Include="packages.config">
153-
<SubType>Designer</SubType>
154-
</None>
155123
</ItemGroup>
156124
<ItemGroup>
157125
<Content Include="__RequestedFeatures.txt" />
@@ -161,13 +129,16 @@
161129
<ItemGroup>
162130
<EmbeddedResource Include="LocalizedMessages.resx" />
163131
</ItemGroup>
132+
<ItemGroup>
133+
<PackageReference Include="Microsoft.AspNet.WebApi.Client">
134+
<Version>5.2.7</Version>
135+
</PackageReference>
136+
<PackageReference Include="Microsoft.Data.Services.Client">
137+
<Version>5.8.4</Version>
138+
</PackageReference>
139+
</ItemGroup>
164140
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
165141
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
166-
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
167-
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
168-
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
169-
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
170-
</Target>
171142
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
172143
Other similar extension points exist, see Microsoft.Common.targets.
173144
<Target Name="BeforeBuild">

Breeze.Sharp/EntityAspect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ private void LinkUnattachedChildren() {
870870
}
871871
} else {
872872
// unidirectional
873-
if (np.ParentType == EntityType) {
873+
if (np.ParentType == EntityType && np.ParentType != np.EntityType) {
874874

875875
parentToChildNp = np;
876876
if (parentToChildNp.IsScalar) {

Breeze.Sharp/JNode.cs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Breeze.Sharp.Core;
1212
using Newtonsoft.Json.Serialization;
1313
using System.Globalization;
14+
using System.Reflection;
1415

1516
namespace Breeze.Sharp {
1617

@@ -59,7 +60,7 @@ public Object ToObject(Type t, bool shouldCamelCase = false) {
5960
public override String ToString() {
6061
return _jo.ToString();
6162
}
62-
63+
6364
public Object Config {
6465
get;
6566
set;
@@ -78,11 +79,11 @@ public void AddPrimitive(String propName, Object value, Object defaultValue = nu
7879
AddRaw(propName, new JValue(value));
7980
}
8081

81-
public void AddEnum<TEnum>(String propName, TEnum value) where TEnum: struct {
82+
public void AddEnum<TEnum>(String propName, TEnum value) where TEnum : struct {
8283
AddRaw(propName, new JValue(value.ToString()));
8384
}
8485

85-
public void AddEnum<TEnum>(String propName, TEnum? value) where TEnum: struct {
86+
public void AddEnum<TEnum>(String propName, TEnum? value) where TEnum : struct {
8687
if (value == null) return;
8788
AddRaw(propName, new JValue(value.ToString()));
8889
}
@@ -110,7 +111,7 @@ public void AddMap<T>(String propName, IDictionary<String, T> map) {
110111
if (!map.Values.Any()) return;
111112

112113
var jn = BuildMapNode<T>(map);
113-
114+
114115
AddRaw(propName, jn._jo);
115116
}
116117

@@ -133,7 +134,14 @@ private void AddRaw(String propName, JToken jt) {
133134
public Object Get(String propName, Type objectType) {
134135
var prop = _jo.Property(propName);
135136
if (prop == null) return null;
136-
var val = prop.Value.ToObject(objectType);
137+
var nonnullableType = objectType.GenericTypeArguments.FirstOrDefault();
138+
// TODO: Ugh.. hack to allow latest NewtonSoft Json to work correctly with nullable enums.
139+
Object val;
140+
if (nonnullableType != null && nonnullableType.GetTypeInfo().IsEnum) {
141+
val = Enum.Parse(nonnullableType, prop.Value.ToString());
142+
} else {
143+
val = prop.Value.ToObject(objectType);
144+
}
137145
return val;
138146
}
139147

@@ -144,7 +152,7 @@ public Object Get(String propName, Type objectType) {
144152
return val;
145153
}
146154

147-
public T GetToken<T>(String propName ) where T: JToken {
155+
public T GetToken<T>(String propName) where T : JToken {
148156
var prop = _jo.Property(propName);
149157
if (prop == null) return null;
150158
return (T)prop.Value;
@@ -160,7 +168,7 @@ public T GetToken<T>(String propName ) where T: JToken {
160168
}
161169
}
162170

163-
public TEnum? GetNullableEnum<TEnum>(String propName) where TEnum: struct {
171+
public TEnum? GetNullableEnum<TEnum>(String propName) where TEnum : struct {
164172
var val = Get<String>(propName);
165173
if (val == null) {
166174
return null;
@@ -170,7 +178,7 @@ public T GetToken<T>(String propName ) where T: JToken {
170178
}
171179

172180
// for non newable types like String, Int etc..
173-
public IEnumerable<T> GetArray<T>(String propName) {
181+
public IEnumerable<T> GetArray<T>(String propName) {
174182
var items = GetToken<JArray>(propName);
175183
if (items == null) {
176184
return Enumerable.Empty<T>();
@@ -185,8 +193,7 @@ public IEnumerable<T> GetArray<T>(params String[] propNames) {
185193
var items = propNames.Select(pn => GetToken<JArray>(pn)).FirstOrDefault(jt => jt != null);
186194
if (items == null) {
187195
return Enumerable.Empty<T>();
188-
}
189-
else {
196+
} else {
190197
return items.Select(item => {
191198
return item.ToObject<T>();
192199
});
@@ -206,7 +213,7 @@ public IEnumerable<Object> GetArray(String propName, IEnumerable<Type> toTypes)
206213

207214
public Dictionary<String, T> GetMap<T>(String propName) {
208215
var map = (JObject)GetToken<JObject>(propName);
209-
216+
210217
var rmap = new Dictionary<String, T>();
211218
if (map == null) return rmap;
212219
foreach (var kvp in map) {
@@ -226,7 +233,7 @@ public Dictionary<String, Object> GetMap(String propName, Func<String, Type> toT
226233
return rmap;
227234
}
228235

229-
public JNode GetJNode(String propName) {
236+
public JNode GetJNode(String propName) {
230237
var item = (JObject)GetToken<JObject>(propName);
231238
if (item == null) return null;
232239
var jNode = new JNode(item);
@@ -252,7 +259,7 @@ public IEnumerable<JNode> GetJNodeArray(String propName) {
252259
public IDictionary<String, JNode> GetJNodeMap(String propName) {
253260
var map = GetToken<JObject>(propName);
254261
if (map == null) return null;
255-
var rmap = ((IDictionary<String, JToken>) map).ToDictionary(kvp => kvp.Key, kvp => new JNode((JObject) kvp.Value));
262+
var rmap = ((IDictionary<String, JToken>)map).ToDictionary(kvp => kvp.Key, kvp => new JNode((JObject)kvp.Value));
256263
return rmap;
257264
}
258265

@@ -267,7 +274,7 @@ public IDictionary<String, IEnumerable<JNode>> GetJNodeArrayMap(String propName)
267274
}
268275
return rmap;
269276
}
270-
277+
271278

272279

273280
// pass in a simple value, a JNode or a IJsonSerializable and returns either a simple value or a JObject or a JArray
@@ -317,7 +324,7 @@ public TextWriter SerializeTo(TextWriter textWriter) {
317324
#else
318325
serializer.Formatting = Formatting.None;
319326
#endif
320-
327+
321328
using (var jtw = new JsonTextWriter(textWriter)) {
322329
serializer.Serialize(jtw, _jo);
323330
jtw.Flush();

Breeze.Sharp/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
// You can specify all the values or you can default the Build and Revision Numbers
2727
// by using the '*' as shown below:
2828

29-
[assembly: AssemblyVersion("0.6.1.0")]
30-
[assembly: AssemblyFileVersion("0.6.1.0")]
29+
[assembly: AssemblyVersion("0.7.0.0")]
30+
[assembly: AssemblyFileVersion("0.7.0.0")]
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{C291ECD4-FD4E-43C2-A6BE-BAB5B7BA8E6E}</ProjectGuid>
7+
<OutputType>Library</OutputType>
8+
<AppDesignerFolder>Properties</AppDesignerFolder>
9+
<RootNamespace>Breeze.Sharp.Tests</RootNamespace>
10+
<AssemblyName>Breeze.Sharp.Tests</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
15+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
16+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
17+
<IsCodedUITest>False</IsCodedUITest>
18+
<TestProjectType>UnitTest</TestProjectType>
19+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
20+
<RestorePackages>true</RestorePackages>
21+
</PropertyGroup>
22+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
23+
<DebugSymbols>true</DebugSymbols>
24+
<DebugType>full</DebugType>
25+
<Optimize>false</Optimize>
26+
<OutputPath>bin\Debug\</OutputPath>
27+
<DefineConstants>TRACE;DEBUG;NOT_NHIBERNATE</DefineConstants>
28+
<ErrorReport>prompt</ErrorReport>
29+
<WarningLevel>4</WarningLevel>
30+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
31+
</PropertyGroup>
32+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
33+
<DebugType>pdbonly</DebugType>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\Release\</OutputPath>
36+
<DefineConstants>TRACE</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
</PropertyGroup>
40+
<PropertyGroup>
41+
<StartupObject />
42+
</PropertyGroup>
43+
<ItemGroup>
44+
<Reference Include="Microsoft.Data.Edm, Version=5.6.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
45+
<HintPath>..\..\..\packages\Microsoft.Data.Edm.5.6.3\lib\net40\Microsoft.Data.Edm.dll</HintPath>
46+
</Reference>
47+
<Reference Include="Microsoft.Data.OData, Version=5.6.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48+
<HintPath>..\..\..\packages\Microsoft.Data.OData.5.6.3\lib\net40\Microsoft.Data.OData.dll</HintPath>
49+
</Reference>
50+
<Reference Include="Microsoft.Data.Services.Client, Version=5.6.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
51+
<HintPath>..\..\..\packages\Microsoft.Data.Services.Client.5.6.3\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
52+
</Reference>
53+
<Reference Include="Newtonsoft.Json">
54+
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.5\lib\net45\Newtonsoft.Json.dll</HintPath>
55+
</Reference>
56+
<Reference Include="System" />
57+
<Reference Include="System.Net.Http" />
58+
<Reference Include="System.Spatial, Version=5.6.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
59+
<HintPath>..\..\..\packages\System.Spatial.5.6.3\lib\net40\System.Spatial.dll</HintPath>
60+
</Reference>
61+
<Reference Include="WindowsBase" />
62+
</ItemGroup>
63+
<Choose>
64+
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
65+
<ItemGroup>
66+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
67+
</ItemGroup>
68+
</When>
69+
<Otherwise>
70+
<ItemGroup>
71+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
72+
</ItemGroup>
73+
</Otherwise>
74+
</Choose>
75+
<ItemGroup>
76+
<Compile Include="MetadataTests.cs" />
77+
<Compile Include="PartialMetadataTests.cs" />
78+
<Compile Include="PredicateQueryTests.cs" />
79+
<Compile Include="StandaloneTests.cs" />
80+
<Compile Include="EdmundsTests.cs" />
81+
<Compile Include="MetadataByHandTests.cs" />
82+
<Compile Include="InheritanceBillingTests.cs">
83+
<SubType>Code</SubType>
84+
</Compile>
85+
<Compile Include="InheritanceProduceTests.cs">
86+
<SubType>Code</SubType>
87+
</Compile>
88+
<Compile Include="ValidationTests.cs" />
89+
<Compile Include="EntityManagerTests.cs" />
90+
<Compile Include="LocalQueryTests.cs" />
91+
<Compile Include="SaveTests.cs" />
92+
<Compile Include="NamedQueryTests.cs" />
93+
<Compile Include="IEditableObjectTests.cs" />
94+
<Compile Include="AttachTests.cs" />
95+
<Compile Include="ExportImportTests.cs" />
96+
<Compile Include="ComplexTypeTests.cs" />
97+
<Compile Include="QueryTests.cs" />
98+
<Compile Include="Properties\AssemblyInfo.cs" />
99+
<Compile Include="TestFns.cs" />
100+
</ItemGroup>
101+
<ItemGroup>
102+
<None Include="app.config" />
103+
<None Include="packages.config" />
104+
</ItemGroup>
105+
<ItemGroup>
106+
<ProjectReference Include="..\..\..\Breeze.Sharp\Breeze.Sharp.csproj">
107+
<Project>{54b1ce10-2847-4565-839a-26da3a51af38}</Project>
108+
<Name>Breeze.Sharp</Name>
109+
</ProjectReference>
110+
<ProjectReference Include="..\Model.CodeCamper\Model.CodeCamper.csproj">
111+
<Project>{3115a147-39a3-4e8f-a8ba-265bb2571acc}</Project>
112+
<Name>Model.CodeCamper</Name>
113+
</ProjectReference>
114+
<ProjectReference Include="..\Model.Edmunds\Model.Edmunds.csproj">
115+
<Project>{c365d56f-1bd4-4d6c-88ef-84f78de9243d}</Project>
116+
<Name>Model.Edmunds</Name>
117+
</ProjectReference>
118+
<ProjectReference Include="..\Model.Inheritance.Billing.Sharp\Model.Inheritance.Billing.Sharp.csproj">
119+
<Project>{58b41cc6-8d34-40c4-9342-db55ae6cca02}</Project>
120+
<Name>Model.Inheritance.Billing.Sharp</Name>
121+
</ProjectReference>
122+
<ProjectReference Include="..\Model.Inheritance.Produce.Sharp\Model.Inheritance.Produce.Sharp.csproj">
123+
<Project>{73c7f5c5-53ee-4f8c-af80-2fd74a9cf553}</Project>
124+
<Name>Model.Inheritance.Produce.Sharp</Name>
125+
</ProjectReference>
126+
<ProjectReference Include="..\Model.Northwind.Sharp\Model.Northwind.Sharp.csproj">
127+
<Project>{e357f17b-6a21-4682-b7c8-3ebfebf862f3}</Project>
128+
<Name>Model.Northwind.Sharp</Name>
129+
</ProjectReference>
130+
</ItemGroup>
131+
<Choose>
132+
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
133+
<ItemGroup>
134+
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
135+
<Private>False</Private>
136+
</Reference>
137+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
138+
<Private>False</Private>
139+
</Reference>
140+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
141+
<Private>False</Private>
142+
</Reference>
143+
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
144+
<Private>False</Private>
145+
</Reference>
146+
</ItemGroup>
147+
</When>
148+
</Choose>
149+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
150+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
151+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
152+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
153+
Other similar extension points exist, see Microsoft.Common.targets.
154+
<Target Name="BeforeBuild">
155+
</Target>
156+
<Target Name="AfterBuild">
157+
</Target>
158+
-->
159+
</Project>

0 commit comments

Comments
 (0)