-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Incremental steps to netnative support #3478
Closed
Closed
Changes from all commits
Commits
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
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
9 changes: 8 additions & 1 deletion
9
src/EntityFramework.Core/Properties/EntityFramework.Core.rd.xml
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 |
---|---|---|
@@ -1,7 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> | ||
<Library> | ||
<Assembly Name="EntityFramework.Core" Activate="All" /> | ||
<!-- TODO optimize this for types that actually need reflection --> | ||
<Assembly Name="EntityFramework.Core" Dynamic="Required All" /> | ||
|
||
<!-- TODO https://github.com/aspnet/EntityFramework/issues/3477 --> | ||
<Type Name="Microsoft.Data.Entity.DbSet{TEntity}"> | ||
<GenericParameter Name="TEntity" Dynamic="Required All"/> | ||
<ImpliesType Name="Microsoft.Data.Entity.Utilities.ImpliedEntityType{TEntity}" Dynamic="Required All"/> | ||
</Type> | ||
|
||
</Library> | ||
</Directives> |
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,79 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
#pragma warning disable 0169 | ||
|
||
using Microsoft.Data.Entity.Storage; | ||
using System; | ||
using Microsoft.Data.Entity.ChangeTracking.Internal; | ||
using Microsoft.Data.Entity.Metadata.Internal; | ||
|
||
namespace Microsoft.Data.Entity.Utilities | ||
{ | ||
// This code exists only to trick the ILC compliation to include metadata | ||
// about combinations of entity types and our internal types. | ||
// This is the jumping off point for a reasoning about what generic types | ||
// may exist at runtime. | ||
// https://github.com/aspnet/EntityFramework/issues/3477 | ||
internal class ImpliedEntityType<TEntity> | ||
where TEntity : class | ||
{ | ||
InternalImplyValuesAndTypes<TEntity> EntityValueProp; | ||
|
||
InternalImpliesTypes<TEntity> EntityProp; | ||
InternalImpliesTypes<char> CharProp; | ||
InternalImpliesTypes<short> Int16Prop; | ||
InternalImpliesTypes<ushort> UInt16Prop; | ||
InternalImpliesTypes<int> Int32Prop; | ||
InternalImpliesTypes<uint> UInt32Prop; | ||
InternalImpliesTypes<long> Int64Prop; | ||
InternalImpliesTypes<long> UInt64Prop; | ||
InternalImpliesTypes<double> DoubleProp; | ||
InternalImpliesTypes<decimal> DecimalProp; | ||
InternalImpliesTypes<float> FloatProp; | ||
InternalImpliesTypes<string> StringProp; | ||
InternalImpliesTypes<bool> BoolProp; | ||
InternalImpliesTypes<byte> ByteProp; | ||
InternalImpliesTypes<Guid> GuidProp; | ||
InternalImpliesTypes<TimeSpan> TimeSpanProp; | ||
InternalImpliesTypes<DateTime> DateTimeProp; | ||
InternalImpliesTypes<DateTimeOffset> DateTimeOffsetProp; | ||
} | ||
|
||
internal class InternalImpliesTypes<T> | ||
{ | ||
void CompileQuery() | ||
=> ((IDatabase)new object()).CompileQuery<T>(null); | ||
|
||
SimpleEntityKeyFactory<T> KeyFactoryType; | ||
} | ||
|
||
internal class InternalImplyTypes<TSystemType, TUserType> | ||
where TUserType : class | ||
{ | ||
ClrPropertyGetter<TUserType, TSystemType> ClrPropertyGetter; | ||
ClrPropertySetter<TUserType, TSystemType> ClrPropertySetter; | ||
} | ||
|
||
internal class InternalImplyValuesAndTypes<TEntity> | ||
where TEntity : class | ||
{ | ||
InternalImplyTypes<char, TEntity> CharProp; | ||
InternalImplyTypes<short, TEntity> Int16Prop; | ||
InternalImplyTypes<ushort, TEntity> UInt16Prop; | ||
InternalImplyTypes<int, TEntity> Int32Prop; | ||
InternalImplyTypes<uint, TEntity> UInt32Prop; | ||
InternalImplyTypes<long, TEntity> Int64Prop; | ||
InternalImplyTypes<long, TEntity> UInt64Prop; | ||
InternalImplyTypes<double, TEntity> DoubleProp; | ||
InternalImplyTypes<decimal, TEntity> DecimalProp; | ||
InternalImplyTypes<float, TEntity> FloatProp; | ||
InternalImplyTypes<string, TEntity> StringProp; | ||
InternalImplyTypes<bool, TEntity> BoolProp; | ||
InternalImplyTypes<byte, TEntity> ByteProp; | ||
InternalImplyTypes<Guid, TEntity> GuidProp; | ||
InternalImplyTypes<TimeSpan, TEntity> TimeSpanProp; | ||
InternalImplyTypes<DateTime, TEntity> DateTimeProp; | ||
InternalImplyTypes<DateTimeOffset, TEntity> DateTimeOffsetProp; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/EntityFramework.MicrosoftSqlServer/Properties/EntityFramework.MicrosoftSqlServer.rd.xml
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> | ||
<Library> | ||
<Assembly Name="EntityFramework.MicrosoftSqlServer" Dynamic="Required All" /> | ||
<!-- TODO optimize this for types that actually need reflection --> | ||
<Assembly Name="EntityFramework.MicrosoftSqlServer" Activate="All" /> | ||
</Library> | ||
</Directives> |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we can do this in providers since primitive type support is tied to providers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a better method is to expose a utility class publicly and let providers pass in their primitive types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that. Also, I kept mulling on it after our in person discussion and here are some of my thoughts:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@divega I added some of the related actionable items of these in #623 (comment).