-
Notifications
You must be signed in to change notification settings - Fork 934
Fix Guid.ToString() #1856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix Guid.ToString() #1856
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
168ea4b
Add test
lillo42 b25d520
fixes bug
lillo42 5b0a70a
Remove unsed folder
lillo42 c68b0ae
improve code
lillo42 cfb2de0
remove duplicate function
lillo42 4657d59
apply to all dialect
lillo42 1427a00
fix test assert order
lillo42 8a3ceab
fix problem on MySQL
lillo42 17540ed
fixes postgresql
lillo42 a700fc6
Fix strguid for Firebird
hazzik 4e97cce
Update FirebirdClient to 6.3.0
hazzik ce8f896
Fix strguid in MySql5Dialect
hazzik f798727
Another attempt fixing MySQL
hazzik d066e72
Trying to fix Oracle
hazzik a0dcade
Another attempt
hazzik f274dc4
Fix for Oracle
hazzik 309e0a3
Forgot a final dash for Oracle
hazzik cd7d155
Simplify query and remove unsed reference on test
lillo42 46d68b4
Merge branch 'master' into fixes-nh3426
lillo42 3b6b1a0
Merge branch 'master' into fixes-nh3426
lillo42 ed9835b
Improve to select on MySQl55 with CHAR
lillo42 f8cc863
Improve MySQL5 query
lillo42 94c0f54
Add where test and fix error
lillo42 11d3b12
Generate async and revert undue change
fredericDelaporte 1768076
Merge branch 'master' into fixes-nh3426
fredericDelaporte db44444
Revert changes
hazzik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
src/NHibernate.Test/Async/NHSpecificTest/NH3426/Fixture.cs
This file contains hidden or 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,88 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by AsyncGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
|
||
using System; | ||
using System.Linq; | ||
using NHibernate.Cfg.MappingSchema; | ||
using NHibernate.Mapping.ByCode; | ||
using NUnit.Framework; | ||
using NHibernate.Linq; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NH3426 | ||
{ | ||
using System.Threading.Tasks; | ||
[TestFixture] | ||
public class FixtureAsync : TestCaseMappingByCode | ||
{ | ||
|
||
protected override HbmMapping GetMappings() | ||
{ | ||
var mapper = new ModelMapper(); | ||
mapper.Class<Entity>(rc => | ||
{ | ||
rc.Id(x => x.Id); | ||
rc.Property(x => x.Name); | ||
}); | ||
return mapper.CompileMappingForAllExplicitlyAddedEntities(); | ||
} | ||
|
||
private const string id = "9FF2D288-56E6-F349-9CFC-48902132D65B"; | ||
|
||
protected override void OnSetUp() | ||
{ | ||
using (var session = OpenSession()) | ||
{ | ||
session.Save(new Entity { Id = Guid.Parse(id), Name = "Name 1" }); | ||
|
||
session.Flush(); | ||
} | ||
} | ||
|
||
protected override void OnTearDown() | ||
{ | ||
using (var session = OpenSession()) | ||
{ | ||
using (var transaction = session.BeginTransaction()) | ||
{ | ||
session.Delete("from System.Object"); | ||
|
||
session.Flush(); | ||
transaction.Commit(); | ||
} | ||
} | ||
} | ||
|
||
[Test] | ||
public async Task SelectGuidToStringAsync() | ||
{ | ||
using (var session = OpenSession()) | ||
{ | ||
var list = await (session.Query<Entity>() | ||
.Select(x => new { Id = x.Id.ToString() }) | ||
.ToListAsync()); | ||
|
||
Assert.AreEqual(id.ToUpper(), list[0].Id.ToUpper()); | ||
} | ||
} | ||
|
||
[Test] | ||
public async Task WhereGuidToStringAsync() | ||
{ | ||
using (var session = OpenSession()) | ||
{ | ||
var list = await (session.Query<Entity>() | ||
.Where(x => x.Id.ToString().ToUpper() == id) | ||
.ToListAsync()); | ||
|
||
Assert.That(list, Has.Count.EqualTo(1)); | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or 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 @@ | ||
using System; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NH3426 | ||
{ | ||
public class Entity | ||
{ | ||
public virtual Guid Id { get; set; } | ||
public virtual string Name { get; set; } | ||
} | ||
} |
This file contains hidden or 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,76 @@ | ||
using System; | ||
using System.Linq; | ||
using NHibernate.Cfg.MappingSchema; | ||
using NHibernate.Mapping.ByCode; | ||
using NUnit.Framework; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NH3426 | ||
{ | ||
[TestFixture] | ||
public class Fixture : TestCaseMappingByCode | ||
{ | ||
|
||
protected override HbmMapping GetMappings() | ||
{ | ||
var mapper = new ModelMapper(); | ||
mapper.Class<Entity>(rc => | ||
{ | ||
rc.Id(x => x.Id); | ||
rc.Property(x => x.Name); | ||
}); | ||
return mapper.CompileMappingForAllExplicitlyAddedEntities(); | ||
} | ||
|
||
private const string id = "9FF2D288-56E6-F349-9CFC-48902132D65B"; | ||
|
||
protected override void OnSetUp() | ||
{ | ||
using (var session = OpenSession()) | ||
{ | ||
session.Save(new Entity { Id = Guid.Parse(id), Name = "Name 1" }); | ||
|
||
session.Flush(); | ||
} | ||
} | ||
|
||
protected override void OnTearDown() | ||
{ | ||
using (var session = OpenSession()) | ||
{ | ||
using (var transaction = session.BeginTransaction()) | ||
{ | ||
session.Delete("from System.Object"); | ||
|
||
session.Flush(); | ||
transaction.Commit(); | ||
} | ||
} | ||
} | ||
|
||
[Test] | ||
public void SelectGuidToString() | ||
{ | ||
using (var session = OpenSession()) | ||
{ | ||
var list = session.Query<Entity>() | ||
.Select(x => new { Id = x.Id.ToString() }) | ||
.ToList(); | ||
|
||
Assert.AreEqual(id.ToUpper(), list[0].Id.ToUpper()); | ||
} | ||
} | ||
|
||
[Test] | ||
public void WhereGuidToString() | ||
{ | ||
using (var session = OpenSession()) | ||
{ | ||
var list = session.Query<Entity>() | ||
.Where(x => x.Id.ToString().ToUpper() == id) | ||
.ToList(); | ||
|
||
Assert.That(list, Has.Count.EqualTo(1)); | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.