Git Product home page Git Product logo

ef6-dbfirst-demo's People

Contributors

entityframeworktutorial 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

ef6-dbfirst-demo's Issues

No try it buttons - eager loading include

Hi, I find your tutorials are very useful and easy to follow. I followed the LINQ tuto at https://www.tutorialsteacher.com/linq/linq-projection-operators
I find that Try it button is a very good idea to see the whole querying/displaying which is missing in this one. For example, in Querying > Eager Loading, we can see how to retrieve data and do a "include standards" but no code that shows how loop through the result and display the information. I googled and tried several things but not able to understand how this can be done
Thanks for your help

Cannot Attach SchoolDB.mdf to localdb

I just started working with this sample (and, by the way, it appears to me to be one of the best sites for help with entity framework) and ran into the attach problem with the error message indicating it couldn't find the .ldf file. My solution, thanks to my daughter who happens to be ea DBA is to execute this code from within MS SQL Server Studio:
sp_attach_db @dbname= N'SchoolDB'
, @filename1= N'C:\Users\jblac\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\EF6-DBFirst-Demo\EF6DBFirstDemo\SchoolDB.mdf'

This was executed after right clicking on "New Query" in the toolbard, dropping the above code changed according to where you put the .mdf file and then selecting " Execute." This seems to me to be an easier solution than others that I looked at in the "closed issues" section and from searching online. I am using the pre-installed localdb (express) version running on windows 11.

Error Attaching mdf file

Hi Folks,

Thank you for putting this project together.

I'm on a win11 box with Sql Server 2022. I have copied the SchoolDB.mdf file to my %SqlServerInstallLocation%\DATA folder.

When I go to attach it in SSMS 19, it gave me the below error. I've googled and tried a number of things with no luck.

Can I please get some advice on how to solve this?

Thank you.

Unable to open the physical file "D:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\SchoolDB_log.ldf". Operating system error 2: "2(The system cannot find the file specified.)".
CREATE DATABASE failed. Some file names listed could not be created. Check related errors. (Microsoft SQL Server, Error: 5120)

Pulled Copy - Cannot Attach DB

Greetings!

I pulled a copy of this to learn a little more about EF6 and it's possibilities. After extracting the ZIP, I was unable to attach the database to my MSSQL 2019 instance. I checked permissions and ensured MSSQL have full rights to the directory and file. But, no matter what I do, attach fails with an file access error.

In `DataGridView`, the fields do not match the vault table

I drag a data source on winform.
I get the following composition of the fields.
In the DataGridView fields:

  • Count;
  • Is ReadOnly;

Question: how to make the fields in the DataGridView meet the fields in the table?
2019-03-20_20-39-17

[CREATE TABLE [dbo].[tbl_01_Groups] 
(
  [id_group] INT  IDENTITY(1,1) NOT NULL,
  [nameGroup] nvarchar(255) COLLATE Cyrillic_General_CI_AS  NULL,
  [Property_1_Group] nvarchar(255) COLLATE Cyrillic_General_CI_AS  NULL,
  [Property_2_Group] nvarchar(255) COLLATE Cyrillic_General_CI_AS  NULL,
  [Property_3_Group] nvarchar(255) COLLATE Cyrillic_General_CI_AS  NULL,
  CONSTRAINT [PK_tbl_01_Groups] PRIMARY KEY NONCLUSTERED ([id_group])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF)  
ON [PRIMARY]
)  
ON [PRIMARY]
GO

ALTER TABLE [dbo].[tbl_01_Groups] SET (LOCK_ESCALATION = TABLE)

CREATE TABLE [dbo].[tbl_03_GroupsStud]
 (
  [id_groupStud] BIGINT  NOT NULL,
  [id_group] INT  NULL,
  [id_stud] BIGINT  NULL,
  [groupStud_descript] nvarchar(255) COLLATE Cyrillic_General_CI_AS  NULL,
  CONSTRAINT [PK_tbl_03_GroupsStud] PRIMARY KEY NONCLUSTERED ([id_groupStud])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF)  
ON [PRIMARY],
  CONSTRAINT [FK_id_grp]
  FOREIGN KEY ([id_group]) 
  REFERENCES [dbo].[tbl_01_Groups] ([id_group]) ON DELETE NO ACTION ON UPDATE NO ACTION
)  
ON [PRIMARY]
GO

ALTER TABLE [dbo].[tbl_03_GroupsStud] SET (LOCK_ESCALATION = TABLE)](url)

Context

using System;
    using System.Data.Entity;
    using System.Data.Entity.Infrastructure;

    public partial class ContextDBF7 : DbContext
    {
        public ContextDBF7()
            : base("name=ContextDBF7")
        {
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            throw new UnintentionalCodeFirstException();
        }

        public virtual DbSet<tbl_01_Groups> tbl_01_Groups { get; set; }
        public virtual DbSet<tbl_03_GroupsStud> tbl_03_GroupsStud { get; set; }
    }

using System;
    using System.Collections.Generic;

    public partial class tbl_01_Groups
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public tbl_01_Groups()
        {
            this.tbl_03_GroupsStud = new HashSet<tbl_03_GroupsStud>();
        }

        public int id_group { get; set; }
        public string nameGroup { get; set; }
        public string Property_1_Group { get; set; }
        public string Property_2_Group { get; set; }
        public string Property_3_Group { get; set; }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<tbl_03_GroupsStud> tbl_03_GroupsStud { get; set; }
    }

using System;
    using System.Collections.Generic;

    public partial class tbl_03_GroupsStud
    {
        public long id_groupStud { get; set; }
        public Nullable<int> id_group { get; set; }
        public Nullable<long> id_stud { get; set; }
        public string groupStud_descript { get; set; }

        public virtual tbl_01_Groups tbl_01_Groups { 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.