-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EntityModel reorg; Deferred loading progress. (Issue #1)
- Loading branch information
1 parent
bf12431
commit c125b8b
Showing
20 changed files
with
345 additions
and
227 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Achilles.Entities.Linq | ||
{ | ||
internal interface IEntityReferenceSource | ||
{ | ||
bool HasSource { get; } | ||
|
||
void SetSource<TSource>( IEnumerable<TSource> source ) where TSource : class; | ||
} | ||
} |
This file contains 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 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 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
30 changes: 30 additions & 0 deletions
30
Achilles.Entities.Sqlite/Modelling/Mapping/Accessors/ColumnAccessor.cs
This file contains 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,30 @@ | ||
#region Copyright Notice | ||
|
||
// Copyright (c) by Achilles Software, All rights reserved. | ||
// | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// | ||
// Send questions regarding this copyright notice to: mailto:[email protected] | ||
|
||
#endregion | ||
|
||
#region Namespaces | ||
|
||
using System.Reflection; | ||
|
||
#endregion | ||
|
||
namespace Achilles.Entities.Modelling.Mapping.Accessors | ||
{ | ||
internal class ColumnAccessor<TEntity, TValue> : MemberAccessor<TEntity,TValue> | ||
where TEntity : class | ||
{ | ||
private readonly MemberInfo _columnInfo; | ||
|
||
public ColumnAccessor( MemberInfo columnInfo ) | ||
: base( columnInfo ) | ||
{ | ||
_columnInfo = columnInfo; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Achilles.Entities.Sqlite/Modelling/Mapping/Accessors/EntityCollectionAccessor.cs
This file contains 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,28 @@ | ||
#region Copyright Notice | ||
|
||
// Copyright (c) by Achilles Software, All rights reserved. | ||
// | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// | ||
// Send questions regarding this copyright notice to: mailto:[email protected] | ||
|
||
#endregion | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using System.Text; | ||
|
||
namespace Achilles.Entities.Modelling.Mapping.Accessors | ||
{ | ||
internal class EntityCollectionAccessor<TEntity, TValue> : MemberAccessor<TEntity,TValue> | ||
{ | ||
MemberInfo _entityCollectionInfo; | ||
|
||
public EntityCollectionAccessor( MemberInfo entityReferenceInfo ) | ||
: base( entityReferenceInfo ) | ||
{ | ||
_entityCollectionInfo = entityReferenceInfo; | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
Achilles.Entities.Sqlite/Modelling/Mapping/Accessors/EntityReferenceAccessor.cs
This file contains 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,62 @@ | ||
#region Copyright Notice | ||
|
||
// Copyright (c) by Achilles Software, All rights reserved. | ||
// | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// | ||
// Send questions regarding this copyright notice to: mailto:[email protected] | ||
|
||
#endregion | ||
|
||
#region Namespaces | ||
|
||
using Achilles.Entities.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
#endregion | ||
|
||
namespace Achilles.Entities.Modelling.Mapping.Accessors | ||
{ | ||
internal class EntityReferenceAccessor<TEntity, TValue> : MemberAccessor<TEntity,TValue> | ||
where TEntity : class | ||
{ | ||
MemberInfo _entityReferenceInfo; | ||
EntityReference<TEntity> _entityReference; | ||
|
||
public EntityReferenceAccessor( MemberInfo entityReferenceInfo ) | ||
: base( entityReferenceInfo ) | ||
{ | ||
_entityReferenceInfo = entityReferenceInfo; | ||
} | ||
|
||
public Type EntityType => typeof( TEntity ); | ||
|
||
public override object GetValue( TEntity entity ) | ||
{ | ||
return base.GetValue( entity ); | ||
} | ||
|
||
public override void SetValue( TEntity entity, object value ) | ||
{ | ||
// The base.GetValue gets the entityReference<> class | ||
var entityReference = base.GetValue( entity ) as IEntityReferenceSource; | ||
|
||
//Type entityReferencePropertyType = entityReferenceProperty.GetType(); | ||
|
||
//// Get the EntitySet<TEntity> | ||
//var entityReference = entityReferencePropertyType.GetGenericArguments().First(); | ||
//var entitySet = _context.EntitySets[ entityReference ]; | ||
|
||
|
||
if ( !entityReference.HasSource ) | ||
{ | ||
entityReference.SetSource( value as IEnumerable<TEntity> ); | ||
} | ||
|
||
//base.SetValue( entity, value ); | ||
} | ||
} | ||
} |
Oops, something went wrong.