Skip to content
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

Key Data Type other than int and writable key (e.g. Guid) #107

Closed
wants to merge 10 commits into from

Conversation

jd4u
Copy link

@jd4u jd4u commented Dec 14, 2013

  • IsKeyWriteable to return default value
  • Insert<T,TKey> method
  • ISqlAdapter.Insert returns TKey
  • SqlServerAdapter.Insert (Set Key value only if writeable)
  • PostgressAdapter.Insert (Set Key value only if writeable)
  • Updated KeyAttribute to support AllowWrite property
  • Tests for Generic with Int64 and Guid datatype.

jd4u and others added 10 commits December 14, 2013 17:46
- IsKeyWriteable to return default value
- Insert<T,TKey> method
- ISqlAdapter.Insert<TKey> returns TKey
- SqlServerAdapter.Insert<TKey> (Set Key value only if writeable)
- PostgressAdapter.Insert<TKey> (Set Key value only if writeable)
- Updated KeyAttribute to support AllowWrite property
- Created RunTestsGeneric
- Setup adds two tables Persons and Managers
- Added TestsGeneric.cs 
- <Compile Include="TestsGeneric.cs" />
- Tests with Int64/Long as BigInt with Identity(0,0) in SqlCE.
- Tests with Guid as UniqueIdentifier in SqlCE with Key created in Code.
…KeyDataType

Conflicts:
	Dapper.Contrib/SqlMapperExtensions.cs
Key Data Type and Upstream updates
@johandanforth johandanforth self-assigned this Jun 11, 2015
@johandanforth
Copy link
Contributor

@jd4u & @majorsilence Have you done any more work around this and support for keys other than integers? As long as it doesn't break existing interfaces I think we should include it.

@majorsilence
Copy link
Contributor

I have a cleaned up copy at https://github.com/majorsilence/dapper-dot-net/commits/KeyDataType that I occasionally rebase.

I have been using this for about a year and have not noticed any problems.

@johandanforth
Copy link
Contributor

Good. I'll try to get a good look at it this weekend.


Från: Peter Gillmailto:notifications@github.com
Skickat: ‎2015-‎06-‎11 12:03
Till: StackExchange/dapper-dot-netmailto:dapper-dot-net@noreply.github.com
Kopia: Johan Danforthmailto:johan_danforth@hotmail.com
Ämne: Re: [dapper-dot-net] Key Data Type other than int and writable key (e.g. Guid) (#107)

I have a cleaned up copy at https://github.com/majorsilence/dapper-dot-net/commits/KeyDataType that I occasionally rebase.

I have been using this for about a year and have not noticed any problems.


Reply to this email directly or view it on GitHub:
#107 (comment)

@majorsilence
Copy link
Contributor

I have a new branch https://github.com/majorsilence/dapper-dot-net/commits/KeyDataType2 that I am using to do my work on this change. It is currently only rebased as of June 11. I was doing some work last night to fix some test failures.

I'll need to rebase again and fix some problems.

@jd4u Currently the TestGeneric.InsertGetUpdate test is failing. I am not as familiar with the changes as you. Would you be wiling to review the above branch to see if I overlooked/broke something from your original changes.

The code below fails with a "Entity must have at least one [Key] property" message.

 connection.Get<IPerson<Int64>>(id);

@NickCraver
Copy link
Member

I think the TKey Insert<TKey> is dead on, and we need to integrate this piece in a non-breaking fashion as discussed in #352. I'm closing this out since we'll merge that one soon - but the functionality is coming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants