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

Low memory footprint... (Initial stubbed-out top-level API) #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Data.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net45", "net45", "{4427BB69
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.Core.k10", "src\Microsoft.Data.Core\Microsoft.Data.Core.k10.csproj", "{C6545CB1-8CC2-4744-9B2E-4118C91FCBAE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.Entity.k10", "src\Microsoft.Data.Entity\Microsoft.Data.Entity.k10.csproj", "{399ACC13-6972-4484-A0BD-9F91296CC220}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.InMemory.k10", "src\Microsoft.Data.InMemory\Microsoft.Data.InMemory.k10.csproj", "{9924B66F-57F3-43F5-89F4-A560A6470DA3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.Relational.k10", "src\Microsoft.Data.Relational\Microsoft.Data.Relational.k10.csproj", "{895E3376-22A5-449D-AAEB-407DD28C4CE7}"
Expand All @@ -23,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.SqlServer.k1
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.Core.net45", "src\Microsoft.Data.Core\Microsoft.Data.Core.net45.csproj", "{77CCDD76-DF5A-4D04-B058-734F0450AB6B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.Entity.net45", "src\Microsoft.Data.Entity\Microsoft.Data.Entity.net45.csproj", "{71415CEC-8111-4C73-8751-512D22F10602}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.InMemory.net45", "src\Microsoft.Data.InMemory\Microsoft.Data.InMemory.net45.csproj", "{BA3F5DBC-EC16-4D5A-8298-8226E6C5ACCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Data.Relational.net45", "src\Microsoft.Data.Relational\Microsoft.Data.Relational.net45.csproj", "{75C5A774-A3F3-43EB-97D3-DBE0CF2825D8}"
Expand Down Expand Up @@ -57,6 +61,16 @@ Global
{C6545CB1-8CC2-4744-9B2E-4118C91FCBAE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C6545CB1-8CC2-4744-9B2E-4118C91FCBAE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C6545CB1-8CC2-4744-9B2E-4118C91FCBAE}.Release|x86.ActiveCfg = Release|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Debug|Any CPU.Build.0 = Debug|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Debug|x86.ActiveCfg = Debug|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Release|Any CPU.ActiveCfg = Release|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Release|Any CPU.Build.0 = Release|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{399ACC13-6972-4484-A0BD-9F91296CC220}.Release|x86.ActiveCfg = Release|Any CPU
{9924B66F-57F3-43F5-89F4-A560A6470DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9924B66F-57F3-43F5-89F4-A560A6470DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9924B66F-57F3-43F5-89F4-A560A6470DA3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -107,6 +121,16 @@ Global
{77CCDD76-DF5A-4D04-B058-734F0450AB6B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{77CCDD76-DF5A-4D04-B058-734F0450AB6B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{77CCDD76-DF5A-4D04-B058-734F0450AB6B}.Release|x86.ActiveCfg = Release|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Debug|x86.ActiveCfg = Debug|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Release|Any CPU.Build.0 = Release|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{71415CEC-8111-4C73-8751-512D22F10602}.Release|x86.ActiveCfg = Release|Any CPU
{BA3F5DBC-EC16-4D5A-8298-8226E6C5ACCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA3F5DBC-EC16-4D5A-8298-8226E6C5ACCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA3F5DBC-EC16-4D5A-8298-8226E6C5ACCC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -176,11 +200,13 @@ Global
{4427BB69-D9D9-47D3-B6BB-59578B1FCF24} = {35BED7DE-CA6F-41EA-91E3-25CA7295C7B9}
{13FEFC36-1C4B-47FC-9086-8D922285D8C4} = {547020C0-976F-4542-81CE-7FD465595614}
{C6545CB1-8CC2-4744-9B2E-4118C91FCBAE} = {383A6616-9885-44BF-B4D0-433DE1CF4501}
{399ACC13-6972-4484-A0BD-9F91296CC220} = {383A6616-9885-44BF-B4D0-433DE1CF4501}
{9924B66F-57F3-43F5-89F4-A560A6470DA3} = {383A6616-9885-44BF-B4D0-433DE1CF4501}
{895E3376-22A5-449D-AAEB-407DD28C4CE7} = {383A6616-9885-44BF-B4D0-433DE1CF4501}
{F86D8125-0DAC-4E9F-81EE-E2EEF23F5D83} = {383A6616-9885-44BF-B4D0-433DE1CF4501}
{2E7C4BB1-9680-40D3-832B-6C5369DB8569} = {383A6616-9885-44BF-B4D0-433DE1CF4501}
{77CCDD76-DF5A-4D04-B058-734F0450AB6B} = {4427BB69-D9D9-47D3-B6BB-59578B1FCF24}
{71415CEC-8111-4C73-8751-512D22F10602} = {4427BB69-D9D9-47D3-B6BB-59578B1FCF24}
{BA3F5DBC-EC16-4D5A-8298-8226E6C5ACCC} = {4427BB69-D9D9-47D3-B6BB-59578B1FCF24}
{75C5A774-A3F3-43EB-97D3-DBE0CF2825D8} = {4427BB69-D9D9-47D3-B6BB-59578B1FCF24}
{4CC98896-FE91-4F16-AE60-D6FF9E905836} = {4427BB69-D9D9-47D3-B6BB-59578B1FCF24}
Expand Down
32 changes: 32 additions & 0 deletions src/Microsoft.Data.Entity/Database.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

namespace Microsoft.Data.Entity
{
using System.Threading.Tasks;

public class Database
{
public void Create()
{
// TODO
}

public bool Delete()
{
// TODO
return false;
}

public Task CreateAsync()
{
// TODO
return Task.FromResult(false);
}

public Task<bool> DeleteAsync()
{
// TODO
return Task.FromResult(false);
}
}
}
43 changes: 43 additions & 0 deletions src/Microsoft.Data.Entity/EntityContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
namespace Microsoft.Data.Entity
{
using System;
using System.Threading;
using System.Threading.Tasks;

public class EntityContext : IDisposable
{
private readonly Database _database = new Database();

public EntityContext(string nameOrConnectionString)
{
// TODO
}

public virtual int SaveChanges()
{
// TODO
return 0;
}

public virtual Task<int> SaveChangesAsync()
{
return SaveChangesAsync(CancellationToken.None);
}

public virtual Task<int> SaveChangesAsync(CancellationToken cancellationToken)
{
// TODO
return Task.FromResult(0);
}

public void Dispose()
{
// TODO
}

public virtual Database Database
{
get { return _database; }
}
}
}
70 changes: 70 additions & 0 deletions src/Microsoft.Data.Entity/EntitySet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

namespace Microsoft.Data.Entity
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

public class EntitySet<TEntity> : IQueryable<TEntity>
where TEntity : class
{
public IEnumerator<TEntity> GetEnumerator()
{
// TODO
throw new NotImplementedException();
}

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}

// TODO
public Type ElementType { get; private set; }

// TODO
public Expression Expression { get; private set; }

// TODO
public IQueryProvider Provider { get; private set; }

public virtual TEntity Add(TEntity entity)
{
// TODO
return entity;
}

public virtual TEntity Remove(TEntity entity)
{
// TODO
return entity;
}

public virtual TEntity Update(TEntity entity)
{
// TODO
return entity;
}

public virtual IEnumerable<TEntity> AddRange(IEnumerable<TEntity> entities)
{
// TODO
return entities;
}

public virtual IEnumerable<TEntity> RemoveRange(IEnumerable<TEntity> entities)
{
// TODO
return entities;
}

public virtual IEnumerable<TEntity> UpdateRange(IEnumerable<TEntity> entities)
{
// TODO
return entities;
}
}
}
16 changes: 16 additions & 0 deletions src/Microsoft.Data.Entity/Properties/InternalsVisibleTo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

using System.Runtime.CompilerServices;

#if !INTERNALS_INVISIBLE

[assembly: InternalsVisibleTo("Microsoft.Data.Core.UnitTest")]

// for Moq

[assembly:
InternalsVisibleTo(
"DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"
)]

#endif
145 changes: 145 additions & 0 deletions src/Microsoft.Data.Entity/QueryableExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

namespace Microsoft.Data.Entity
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;

public static class QueryableExtensions
{
public static IQueryable<T> Include<T, TProperty>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should leave Include out since we aren't planning to have it around to start with.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming MusicStore currently depends on it, I think we can leave it in until we figure out what to replace it with.

this IQueryable<T> source, Expression<Func<T, TProperty>> path)
{
// TODO
return source;
}

public static Task<bool> AnyAsync<TSource>(this IQueryable<TSource> source)
{
// TODO
return source.AnyAsync(CancellationToken.None);
}

public static Task<bool> AnyAsync<TSource>(this IQueryable<TSource> source, CancellationToken cancellationToken)
{
// TODO
return Task.FromResult(false);
}

public static Task<bool> AnyAsync<TSource>(
this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
{
// TODO
return source.AnyAsync(predicate, CancellationToken.None);
}

public static Task<bool> AnyAsync<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate,
CancellationToken cancellationToken)
{
// TODO
return Task.FromResult(false);
}

public static Task<List<TSource>> ToListAsync<TSource>(this IQueryable<TSource> source)
{
// TODO
return ToListAsync(source, CancellationToken.None);
}

public static Task<List<TSource>> ToListAsync<TSource>(
this IQueryable<TSource> source,
CancellationToken cancellationToken)
{
// TODO
return Task.FromResult<List<TSource>>(null);
}

public static Task<TSource> SingleAsync<TSource>(this IQueryable<TSource> source)
{
// TODO
return source.SingleAsync(CancellationToken.None);
}

public static Task<TSource> SingleAsync<TSource>(
this IQueryable<TSource> source,
CancellationToken cancellationToken)
{
// TODO
return Task.FromResult(default(TSource));
}

public static Task<TSource> SingleAsync<TSource>(
this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
{
// TODO
return source.SingleAsync(predicate, CancellationToken.None);
}

public static Task<TSource> SingleAsync<TSource>(
this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate,
CancellationToken cancellationToken)
{
// TODO
return Task.FromResult(default(TSource));
}

public static Task<TSource> SingleOrDefaultAsync<TSource>(this IQueryable<TSource> source)
{
// TODO
return source.SingleOrDefaultAsync(CancellationToken.None);
}

public static Task<TSource> SingleOrDefaultAsync<TSource>(
this IQueryable<TSource> source,
CancellationToken cancellationToken)
{
// TODO
return Task.FromResult(default(TSource));
}

public static Task<TSource> SingleOrDefaultAsync<TSource>(
this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
{
// TODO
return source.SingleOrDefaultAsync(predicate, CancellationToken.None);
}

public static Task<TSource> SingleOrDefaultAsync<TSource>(
this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate,
CancellationToken cancellationToken)
{
// TODO
return Task.FromResult(default(TSource));
}

public static Task<decimal> SumAsync(this IQueryable<decimal> source)
{
// TODO
return source.SumAsync(CancellationToken.None);
}

public static Task<decimal> SumAsync(this IQueryable<decimal> source, CancellationToken cancellationToken)
{
// TODO
return Task.FromResult(default(decimal));
}

public static Task<int> SumAsync(this IQueryable<int> source)
{
// TODO
return source.SumAsync(CancellationToken.None);
}

public static Task<int> SumAsync(this IQueryable<int> source, CancellationToken cancellationToken)
{
// TODO
return Task.FromResult(0);
}
}
}
15 changes: 15 additions & 0 deletions src/Microsoft.Data.Entity/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version" : "0.1-pre-*",
"dependencies": {
"Microsoft.AspNet.DependencyInjection" : "0.1-alpha-*"
},
"configurations": {
"net45": {
"dependencies": {
"Microsoft.Bcl.Immutable" : "1.0.30",
"System.Runtime" : ""
}
},
"k10": {}
}
}