View Poll Results: Key or entity first?

Voters
2. You may not vote on this poll
  • Entity type then key type

    0 0%
  • Key type then entity type

    2 100.00%
Results 1 to 8 of 8

Thread: Style question: key before entity or entity before key?

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Style question: key before entity or entity before key?

    I am putting together a type-safe version of the Repository Pattern by passing both the entity type and its corresponding key type. The style question is should the key or the entity go first in the definition?

    e.g.
    VB.net Code:
    1. ''' <summary>
    2. ''' Interface to support reading entities from the backing store
    3. ''' </summary>
    4. ''' <typeparam name="TEntity">
    5. ''' The key-identified type of entity we are reading
    6. ''' </typeparam>
    7. ''' <typeparam name="TKey">
    8. ''' The type of the key
    9. ''' </typeparam>
    10. ''' <remarks>
    11. ''' In this architecture there is a seperate read and write interface but often this
    12. ''' pattern has just the one interface for both functions
    13. ''' </remarks>
    14. Public Interface IRepositoryRead(Of TEntity As IKeyedEntity(Of TKey), In TKey)

    or

    VB.net Code:
    1. ''' <summary>
    2. ''' Interface to support reading entities from the backing store
    3. ''' </summary>
    4. ''' <typeparam name="TEntity">
    5. ''' The key-identified type of entity we are reading
    6. ''' </typeparam>
    7. ''' <typeparam name="TKey">
    8. ''' The type of the key
    9. ''' </typeparam>
    10. ''' <remarks>
    11. ''' In this architecture there is a seperate read and write interface but often this
    12. ''' pattern has just the one interface for both functions
    13. ''' </remarks>
    14. Public Interface IRepositoryRead(Of In TKey, TEntity As IKeyedEntity(Of TKey))

    Thoughts?
    Last edited by Merrion; Feb 3rd, 2014 at 05:28 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width