1
votes

I'm trying to get an example of EF 7 with Azure Table Storage to work in VS 14 CTP3, but I am having no luck with the dependency injection stuff. I was able to get an example with SQL done fairly easily, but I am seeing an issue that doesn't make sense: The referenced package is there and being pulled in, and if I look at it, it contains the correct namespaces, methods, clases etc., but the compile doesn't like it.

Here is my project.json:


    {
        "dependencies": {
            "Microsoft.AspNet.Server.IIS": "1.0.0-alpha3",
            "EntityFramework.AzureTableStorage": "7.0.0-alpha3",
            "Microsoft.AspNet.RequestContainer": "1.0.0-alpha3"
        },
        "frameworks" : {
            "net451" : { },
            "k10" : { }
        }
    }


    using System;
    using Microsoft.AspNet.Builder;
    using Microsoft.Data.Entity;  /* <- 'missing reference' unless I add EntityFramework to project.json */
    using Microsoft.Data.Entity.AzureTableStorage; /* <- ALWAYS errors w/ 'missing reference' */
    using Microsoft.Framework.DependencyInjection;


    namespace WebApplication2
    {
        public class Startup
        {
            public void Configure(IBuilder app)
            {
                app.UseServices(services =>
                {
                    services.AddEntityFramework()  /* <-- this errors too */
                        .AddAzureTableStorage();

                    services.SetupOptions<DbContextOptions> //,- says it can't find this
                        (config => config.UseAzureTableStorage("UseDevelopmentStorage=true"));
                });

            }
        }
    }

The strange thing is, if I right click and 'go to definition' on any of the 'missing' classes or methods, it brings them up, and I can see that I'm using them as defined. Am I missing something terribly obvious? Or is this stuff just not fully cooked yet?

1
EntityFramework.AzureTableStorage is available for Desktop CLR (net451) only so if you target Core CLR (k10), you would face this issue. What is your target framework for compilation ?Suhas Joshi
I looked at that. What I did was right-click on the project file and examine the properties. The Active Target Framework is set to .Net Framework 4.5.1 and not Core 4.5. Is this the correct way to set that?richard

1 Answers

1
votes

Your project.json has both frameworks mentioned so VS builds both of them. If your intention is to just build for net451, you should remove the following from your project.json - "k10" : { }