Code Monkey home page Code Monkey logo

entityframework.docs's Introduction

Entity Framework Docs

This project contains the source for EF Core and EF6 documentation published at Entity Framework documentation.

Documentation issues for both EF Core and EF6 should be filed in this repo. Product issues (bugs) should be filed in the EF Core repo or the EF6 repo as appropriate.

We accept pull requests!

Fixing typos/spelling/grammar/etc

Consider sending a pull request rather than filing an issue. This can be done entirely from the web:

  • From upper right corner of the document, select the pen icon: image

    Note: You might need to make the browser window wider to see the pen icon.

  • Click on the edit button (โœ๏ธ) to edit in your web browser

image

  • When done, add a title and description, then use the Create a new branch and start a pull request. option.

image

Note that you can also clone this repo and do a GitHub PR in the normal way.

Making more substantial changes

Pull requests for more substantial changes are also encouraged. However, before submitting a pull request, please read the CONTRIBUTING guidelines, which include information on how to build the docs locally, as well as style and organizational guidance.

entityframework.docs's People

Contributors

0xced avatar ajcvickers avatar andriysvyryd avatar bricelam avatar cincuranet avatar divega avatar erhanalankus avatar erikej avatar gurmeetsinghdke avatar jeremylikness avatar kustox avatar lajones avatar mairaw avatar maumar avatar natemcmaster avatar ooberoi avatar rick-anderson avatar roji avatar rowanmiller avatar scottaddie avatar simoncropp avatar smitpatel avatar spottedmahn avatar tdykstra avatar v-anpasi avatar v-makoud avatar v-maudel avatar vanillajonathan avatar wadepickett avatar yukozh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

entityframework.docs's Issues

UWP limitations and workarounds

RC1 will not resolve completely all issues in using EF with UWP. We should document and provide work arounds for some likely scenarios:

1. SQlite with transactions.

(Cref aspnet/Microsoft.Data.Sqlite#116)

Users need to explicitly specify the temporary directory for SQLite as the default working directory is unwritable. Transactions will throw "SQLite Error 1: 'SQL logic error or missing database'".

2. .NET Native query limitations

Support for query drastically improves with dotnet/efcore#3516. However, the static analysis run in the ILC step cannot completely identify all possible uses of user types inside of the query pipeline (e.g. anonymous types.) Users are likely to encounter strange MissingRuntimeArtifactException's. This can be avoid by simplifying the query or running on the client. For SQLite, this may be the better solution.

3. Default folder for relative paths is unwritable

(cref aspnet/Microsoft.Data.Sqlite#55)
Sqlite attempts to use the package folder by default, which is unwritable.
E.g.

options.UseSqlite("Filename=./blog.db"); // this throws
options.UseSqlite("Filename=" + ApplicationData.Current.LocalFolder.Path + "/blog.db"); // workaround

Modeling: Configuration

Things that need to be covered to complete this work:

  • Inheritance (base type and discriminator)
  • HasSequence
  • HasDefaultSchema
  • HasComputedColumnSql
  • HasDefaultValue
  • HasDefaultValueSql
  • [Timestamp]

Mac OS X ef migration and SQLite.Design

I don't know if it's just me, or something else. In upgrading from beta8 to rc1, I deleted my migrations folder, and the database, and changed all the names for the assemblies in all the right places, and changed by project.json file to -rc1-final for everything...and then re-ran my migration dnx ef migrations add MyFirstMigration - I got stopped by a missing "EntityFramework.Sqlite.Design": "7.0.0-rc1-final" assembly. I figured it out after a little bit of research, but it's not in the docs for the example. Is this something that should be added to the example for the OS X getting started piece?

Document how to use a value comparer to compensate for different behavior of string comparisons in client and store

Typically string comparisons performed on the store can have different behaviors to comparisons in memory, e.g. trailing blanks and casing may be ignored in the store.

In previous versions of EF this made things like fixup of string keys hard to predict: related data would be pulled from the database because the FK and PK values matched according to the server semantics but once in memory the strings didn't match and therefore fixup didn't happen. This is described in more detail in CodePlex dotnet/efcore#284.

This kind of difference appears more often when working with existing data, so how important this is depends on how much we prioritize those scenarios. If the data was stored by EF then string keys have a better chance to be an exact match.

The idea to address this is that on the client, EF Core could always use a custom string comparison algorithm that would mimic the behavior in the database. That is, one that ignores trailing blanks and casing.

Adding EF Core to a standalone class library

I spent yesterday getting tripped on on why I was unable to create a working EF7 standalone class library. Specifically a pattern that I like to use is to create a Model project so that additional applications can be created to load models and data access on their own without WEB.

This can allow for a console app, web app (and other projects) to use the same set of models, services and interfaces.

While following the guide, I tried choosing File -> New -> Class Library (Package) instead of console application or ASP.NET web application.

This failed because the default project.json file on a class lib comes in with

"frameworks": {
  "dotnet": { }
}

instead of

"frameworks": {
  "dnx451": { },
  "dnxcore50": { }
}

I'd like to suggest adding a note to getting started aspnet as seen in the following commit AlexChesser@ac3ae50

.. note::
    If you are attempting to create a standalone class library as data layer shared across multiple applications, ensure that the ``frameworks`` section of the ``project.json`` is updated to replace ``dotnet`` with ``dnx451`` and ``dnxcore50``.  This will ensure that the library has a reference to the ``Microsoft.Data.Entity`` namespace.

.. literalinclude:: aspnet5/sample/src/EFGetStarted.AspNet5/project.json
        :language: json
        :linenos:
        :lines: 25-28
        :emphasize-lines: 2-3

It's not so much extra but could help save someone a few extra minutes.

NuGet version for VS2015

I tried to run ...

Install-Package EntityFramework.SqlServer โ€“Pre

... on an existing project that was under source control. This produces lots of errors like There is no working folder for (path) as described here.
Installing the nuget 3.2RC vsix fixed this. So, the Getting Started series of documents should be changed to reflect that, especially the one for Full.NET, as there's explicit hints to update the NuGet version for the older versions of Visual Studio.

TagHelpers

It would be a big help to introduce TagHelpers here and use them instead of HTML Helpers. This walkthrough doesn't prepare me to understand the Web Application template, which uses TagHelpers exclusively.

"dnx ef database update" step fails with "Unable to find an entry point named 'sqlite3_close_v2' in DLL 'sqlite3'."

I encountered this error by following the instructions under "Getting Started on OSX" using Mac OS 10.9.5 and dnx/dnu 1.0.0-rc1-16231. All went well until trying to apply database migrations:
https://ef.readthedocs.org/en/latest/getting-started/osx.html#create-your-database

$ dnx ef database update
System.EntryPointNotFoundException: Unable to find an entry point named 'sqlite3_close_v2' in DLL 'sqlite3'.
   at Microsoft.Data.Sqlite.Interop.NativeMethods.sqlite3_close_v2(IntPtr db)
   at Microsoft.Data.Sqlite.Interop.Sqlite3Handle.ReleaseHandle()
   at System.Runtime.InteropServices.SafeHandle.InternalDispose()
   at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing)
   at System.Runtime.InteropServices.SafeHandle.Dispose()
   at Microsoft.Data.Sqlite.SqliteConnection.Close()
   at Microsoft.Data.Entity.Storage.RelationalConnection.Close()
   at Microsoft.Data.Entity.Storage.Internal.SqliteRelationalConnection.Close()
   at Microsoft.Data.Entity.Storage.Internal.RelationalCommand.Execute[T](IRelationalConnection connection, Func`3 action, String executeMethod, Boolean openConnection, Boolean closeConnection)
   at Microsoft.Data.Entity.Migrations.HistoryRepository.Exists()
   at Microsoft.Data.Entity.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.Data.Entity.Design.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
   at Microsoft.Data.Entity.Commands.Program.Executor.Execute(Action action)
Unable to find an entry point named 'sqlite3_close_v2' in DLL 'sqlite3'.

This seems like a version mismatch, but I don't know where. SQLite itself added "sqlite3_close_v2" in 3.7.14 in 2012. Mac OS X 10.9.5 comes with SQLite 3.7.13, but I'm not sure if the version of SQLite included with the OS is even related.

Here the versions of packages that I have (other than SQLite and ones specified by the project.json):

$ dnx --version
Microsoft .NET Execution environment
 Version:      1.0.0-rc1-16231
 Type:         CoreClr
 Architecture: x64
 OS Name:      Darwin
 OS Version:   10.9
 Runtime Id:   osx.10.9-x64
$ dnu --version
Microsoft .NET Development Utility
 Version:      1.0.0-rc1-16231
 Type:         CoreClr
 Architecture: x64
 OS Name:      Darwin
 OS Version:   10.9
 Runtime Id:   osx.10.9-x64
$ dnvm --version
1.0.0-rc2-15546

Suggestions would be appreciated!

Add note about splitting model into seperate files

In the 101 walkthoughs we put the whole model in a single file (as this makes it much simpler to follow along). We should add a note saying this isn't what you would typically do in a real app - should appear on all the getting started pages.

Working with Transactions

In particular, how to achieve scenarios that would previously have been done with TransactionScope

Unit testing EF7

It would be great to have an official doc on unit testing with EF7.

SQLite: Limitations in migrations

Create an article to show how to work-around the limitations in SQLite's support for migrations.

screen shot 2015-08-24 at 10 27 55 am

- [ ] Show how to use `.Sql()` in migrations to do a table rebuild. - [ ] Link to [Making Other Kinds Of Table Schema Changes](http://sqlite.org/lang_altertable.html#otheralter) - [ ] Link to https://github.com/dotnet/efcore/issues/329 for future reference when we (might) support rebuild operations

Example: To enable reverse engineering from an existing database does not work

https://github.com/aspnet/EntityFramework.Docs/blob/master/docs/getting-started/full-dotnet/existing-db.rst

The example to enable reverse engineering from an existing database does not work:
Scaffold-DbContext -provider EntityFramework.MicrosoftSqlServer -connection "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;"

when I tried this is vs2015 I get

The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:19

  • Scaffold-DbContext <<<< -provider EntityFramework.MicrosoftSqlServer -connection "Server=sqldev\sqltest;Database=IveyCore;Trusted_Connection=True;"
    • CategoryInfo : ObjectNotFound: (Scaffold-DbContext:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

stub-icon

I am getting this error when compiling the docs:

stub-topic.txt:1: ERROR: Invalid character code: U+1F527
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
stub-topic.txt:1: WARNING: Substitution definition "stub-icon" empty or invalid.

Is there fonts that need to be installed as well?

Some problems with foreign key

I start one new project with Visual Studio 2015 with Update 1 RC and ASPNET 5 RC1 and add models from page
http://ef.readthedocs.org/en/latest/modeling/relational/fk-constraints.html
I saved and build .(without errors)
Also I run from command line:

dnvm use 1.0.0-rc1-final
dnx ef migrations add First
dnx ef database update

After scaffold operations, blogs pages works. I create 2 blogs entries.
Also list view from posts works.
The problem is in create new post page. The combo box blog reference list is empty. I expected to find the 2 blogs entries from previous action.

Please look again to this web page doc or/and tell me where I wrong.

Best regards

Docs for all FWLinks

We have several FWLinks that are used in exception messages etc. We need to make sure we have docs for each of these and that the links are updated to forward to the right doc.

Question - PDF

I found two PDFs on readthedocs.org for EF and MVC dated mid-July. Were these PDFs done by this group or someone else, if it was this group a hyperlink somewhere would be nice to get the PDFs - if there is one I cannot find it :)

On to the real question - I can compile the project into HTML but I cannot get rst2pdf integrated properly with Sphinx to compile to PDF. Has anyone here done this on Windows? When I try integrating rst2pdf I get an exception occurred - I am not look to troubleshoot that exception.

Providers: Summary

Summary of what providers there are for EF7, their current state, platforms they work on, etc.

Powershell version on Windows 7

If one follows the tutorial here and does so on a box running Windows 7, chances are that they'll receive the following error ...

The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:14
+ Add-Migration <<<<  MyFirstMigration
    + CategoryInfo          : ObjectNotFound: (Add-Migration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

... when trying to execute Add-Migration MyFirstMigration.

This is due to the fact that Powershell may be Version 2 or 3. It needs to be Version 4 for this to work.
I had this issue on two separate W7 boxes on which I tried playing with EF7, so I think other people may run into this as well. The first time it took me almost a day to figure this out. So a hint towards this in the tutorial may be a good idea.
Installing an update from here fixed it.

Example code for Many to Many relationships?

I saw the example for setting up the data model using Code First, but is there example code of how to use it in a controller or repository? I've tried a couple of examples found elsewhere on the internet, but none are EF7, and while I'm likely not doing it right, I'd like to know that there is a working EF7 example that I can reproduce and then go from there.

Tag Helpers and label asp-for not showing the label

From @rhires on October 23, 2015 14:18

Hello...so I have this code, straight from ef.readthedocs.org, in the aspnet5 section (unzipped the example, navigated down to the proper level, ran dnu restore, then dnx web)...and for some reason or other, it doesn't show the label in the rendered view for the "create" section. I know that the inputs are correct, it's just the labels that are invisible. The question is: do I have to update the POCOs in the model to have display attributes to be able to see the label? Actually, to answer my question, no, updating the POCO with the [Display] attribute didn't change anything.

I'm running beta8, on Yosemite. Unfortunately, there isn't that much regarding tag helpers, and I haven't seen this one anywhere.

Copied from original issue: dotnet/aspnetcore#1025

How to write a provider

One of the specific things we need to cover is what goes in the DatabaseModel object and how that affects the ScaffoldingModel generation. What goes in TableModel.Indexes ? Should PK indexes be included or ignored? Does ForeignKeyModel.Name need to be unique? etc.

Separate files for classes and context

In the sample projects, the Models.cs class contains the context and the classes all in one file. While I can add a new class (e.g., "User") and add it to the context in this file and create a successful migration (both adding and applying), if I attempt the same operation where the class (my "User") as a separate file ("UserModel.cs"), the migration gets created, but the migration apply fails. I get an error (stack trace is below) that says sqlite cannot support this migration operation. However, in VSCode, when I go to look at the code after the migration add step, I have a different issue: it says (I called it "FirstMigration), "FirstMigration does not implement inherited abstract member 'Migration.id.get' [dnx451, dnxcore50]..." Now, I attempt to implement that, but it later says that it already exists. And if I look in the .Designer, sure enough, there's an Id that's defined. As far as I can tell, the file is the same as the other ones where there was a successful migration add and apply.

Here's the stack trace.

System.NotSupportedException: SQLite cannot support this migration operation.
  at Microsoft.Data.Entity.Sqlite.Migrations.SqliteMigrationSqlGenerator.Generate (Microsoft.Data.Entity.Migrations.Operations.AlterColumnOperation operation, IModel model, Microsoft.Data.Entity.Infrastructure.SqlBatchBuilder builder) [0x00000] in <filename unknown>:0 
  at (wrapper dynamic-method) object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object,object,Microsoft.Data.Entity.Metadata.IModel,Microsoft.Data.Entity.Infrastructure.SqlBatchBuilder)
  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[Object,Object,IModel,SqlBatchBuilder] (System.Runtime.CompilerServices.CallSite site, System.Object arg0, System.Object arg1, IModel arg2, Microsoft.Data.Entity.Infrastructure.SqlBatchBuilder arg3) [0x00000] in <filename unknown>:0 
  at (wrapper delegate-invoke) System.Action`5<System.Runtime.CompilerServices.CallSite, object, object, Microsoft.Data.Entity.Metadata.IModel, Microsoft.Data.Entity.Infrastructure.SqlBatchBuilder>:invoke_void_T1_T2_T3_T4_T5 (System.Runtime.CompilerServices.CallSite,object,object,Microsoft.Data.Entity.Metadata.IModel,Microsoft.Data.Entity.Infrastructure.SqlBatchBuilder)
  at (wrapper dynamic-method) object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object,object,Microsoft.Data.Entity.Metadata.IModel,Microsoft.Data.Entity.Infrastructure.SqlBatchBuilder)
  at Microsoft.Data.Entity.Migrations.Sql.MigrationSqlGenerator.Generate (IReadOnlyList`1 operations, IModel model) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Migrations.Migrator.ApplyMigration (Microsoft.Data.Entity.Migrations.Migration migration) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Migrations.Migrator.ApplyMigrations (System.String targetMigration) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Commands.MigrationTool.ApplyMigration (System.String migrationName, System.String contextTypeName, System.String startupAssemblyName) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Commands.Program+<>c__DisplayClass13_0.<ApplyMigration>b__0 () [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Commands.Program.Execute (System.String startupProject, System.Func`1 invoke) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Commands.Program.ApplyMigration (System.String migration, System.String context, System.String startupProject) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Commands.Program+<>c__DisplayClass10_3.<Main>b__9 () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute (System.String[] args) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Commands.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.ApplicationHost.Program.ExecuteMain (Microsoft.Framework.Runtime.DefaultHost host, System.String applicationName, System.String[] args) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) [0x00000] in <filename unknown>:0 
  at dnx.host.Bootstrapper.RunAsync (System.Collections.Generic.List`1 args, IRuntimeEnvironment env, System.Runtime.Versioning.FrameworkName targetFramework) [0x00000] in <filename unknown>:0 

Creating an InMemory database with ninject

I have used

          var serviceCollection = new ServiceCollection();
          serviceCollection
            .AddEntityFramework()
            .AddInMemoryDatabase()
            .AddDbContext<SampleContext>(c => c.UseInMemoryDatabase());

To successfully get a clean, new in memory database when doing unit tests.

I want to do the same using ninject.

I have tried

        var kernel = new StandardKernel();
        var options = new DbContextOptionsBuilder();
        options.UseInMemoryDatabase();

        kernel.Bind<MemberContext>().To<MemberContext>().WithConstructorArgument(options.Options);

        var memberContext = kernel.Get<MemberContext>();
        /// add rows to dbset and save

But with this code (in the constructor) is run a second time it throws an exception because the "rows" already exist.

Multiple projects and migrations

I seem to be in a bit of circular issue: I have a Web and a Business project. All my db access is in Business, and so when I'm in my Business directory, and run the command dnx ef migrations add FirstMigration, I get error messages complaining that "A type named 'StartupProduction' or 'Startup' could not be found in assembly Business" - but Startup wouldn't be here, it would be in the other directory/project. But if I do go into my Web project directory, I get different errors about there being no DbContext...

So is that right? Do I need a Startup.cs in my Business project? Or is there some kind of service I need to add (and more than a using statement that points to my Business project, since I have that) to the Startup.cs file?

PS Need to transfer this to the EF area, as it isn't really a documentation issue I have...

Logging

In particular, how to get logging of SQL statements on non-dnx projects

Testing with InMemory

The most important thing is how to scope the database to a single test...

using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq;

namespace ConsoleApp1
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();
            serviceCollection
                .AddEntityFramework()
                .AddInMemoryDatabase()
                .AddDbContext<SampleContext>(c => c.UseInMemoryDatabase());


            using (var db = serviceCollection.BuildServiceProvider().GetService<SampleContext>())
            {
                db.Blogs.Add(new Blog { Url = "Test" });
                db.SaveChanges();
                Console.WriteLine(db.Blogs.Count());
            }

            using (var db = serviceCollection.BuildServiceProvider().GetService<SampleContext>())
            {
                db.Blogs.Add(new Blog { Url = "Test" });
                db.SaveChanges();
                Console.WriteLine(db.Blogs.Count());
            }
        }
    }

    public class SampleContext : DbContext
    {
        public DbSet<Blog> Blogs { get; set; }
    }

    public class Blog
    {
        public int BlogId { get; set; }
        public string Url { get; set; }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.