Aún no tienes acceso a esta clase

Crea una cuenta y continúa viendo este curso

Agregar modelos y configuración en mi Web Api

9/17
Recursos

Aportes 17

Preguntas 1

Ordenar por:

¿Quieres ver más aportes, preguntas y respuestas de la comunidad? Crea una cuenta o inicia sesión.

Siento que este maestro asume que sabemos cosas… no sé si esta clase originalmente viene de una ruta en la que hace más sentido este curso. Yo la estoy tomando en la Escuela de Data Science. Saludos

Si quieren usar los atajos que usa el profe como prop, etc, instalen esta extension en su visual studio code

saludos

NuGet que debemos agregar para podernos conectar con la B.D.

- ENTITY FRAMEWORK CORE
<PackageReference Include=“Microsoft.EntityFrameworkCore” Version=“2.2.6” />

- ENTITY FRAMEWORK CORE SQL SERVER
<PackageReference Include=“Microsoft.EntityFrameworkCore.SqlServer” Version=“2.2.6” />

Este curso viene con un plus, aprender aprendiendo c#.

Lo ideal es trabajar con versiones estable para evitar errores

Hola compañeros yo igual tu errores “error nu1107 version conflict detected” sobre todo y me puse a agregar Packages como me lo fué pidiendo la terminal hasta que jaló sin problemas, así quedó el código final, espero le sirva a alguno.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.6" />
    <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Primitives" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="2.2.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="2.2.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
  </ItemGroup>

</Project>

Solo asi pude instalar las librerias

• dotnet add package Microsoft.EntityFrameworkCore
• dotnet add package Microsoft.EntityFrameworkCore.SqlServer
• dotnet add package Microsoft.EntityFrameworkCore.Tools

https://www.nuget.org/ para descargar el framework

Toco hacer los cursos de #C

Que extension se utiliza para tener las referencias en codigo? las que dicen por ahora
0 references

Estoy haciendo la ruta de DS y la verdad me parece que este curso esta fuera de contexto.

Si presentan un error similar al relacionado abajo, les comparto la solucion, a mi me paso:
ApiSQLPlatzi -> Microsoft.EntityFrameworkCore.SqlServer 2.1.3 -> Microsoft.EntityFrameworkCore.Relational (>= 2.1.3)

error NU1107: ApiSQLPlatzi -> Microsoft.AspNetCore.App 2.1.0 -> Microsoft.EntityFrameworkCore.Relational (= 2.1.0).

El mismo dialogo de la terminal indica la solucion, la version solicitada por el software, en este caso es:
(= 2.1.0).
o
(>= 2.1.3)
para eso debes descargar o relacionar la version exaca que solicita el sistema, a continuacion les dejo las versiones que use y me corrigieron todos los problemas.

<PackageReference Include=“Microsoft.EntityFrameworkCore” Version=“2.1.0” />
<PackageReference Include=“Microsoft.EntityFrameworkCore.SqlServer” Version=“2.1.0” />
<PackageReference Include=“Microsoft.AspNetCore.Razor.Design” Version=“2.1.0” />

Despues de esto ejecutan los comandos:

dotnet restore (Para robarme todos los paquetes de nube y agregarlos a mi proyecto, como indico el profesor en el video)

dotnet build

Adicionalemnte les comparti el link donde encuentran la solicion detallada. Espero les sirva. Saludos!

https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1107

Con MicrosoftEntityFrameworkCore para trabajar con api

C# enlos plugin de VSCode para dejater hacer controller y class en C#

Muy buenas explicacion

hola al hacer el dotnet build me sale lo siguientes errores

PS C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql> dotnet build
Microsoft ® Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright © Microsoft Corporation. All rights reserved.

Restore completed in 13.14 ms for C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj.
Models\Contactscontext.cs(1,17): error CS0234: The type or namespace name ‘EntityFrameworkCore’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]

Models\Contactscontext.cs(1,17): error CS0234: The type or namespace name ‘EntityFrameworkCore’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
Models\Contactscontext.cs(5,36): error CS0246: The type or namespace name ‘DbContext’ could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
Models\Contactscontext.cs(7,32): error CS0246: The type or namespace name ‘DbContextOptions’ could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
0 Warning(s)
3 Error(s)

Time Elapsed 00:00:00.71
PS C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql> dotnew restore
dotnew : The term ‘dotnew’ 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:1

  • dotnew restore
  •   + CategoryInfo          : ObjectNotFound: (dotnew:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

PS C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql> dotnet restore
Restore completed in 12.31 ms for C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj.
PS C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql> dotnet build
Microsoft ® Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright © Microsoft Corporation. All rights reserved.

Restore completed in 11.73 ms for C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj.
Models\Contactscontext.cs(1,17): error CS0234: The type or namespace name ‘EntityFrameworkCore’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
Models\Contactscontext.cs(5,36): error CS0246: The type or namespace name ‘DbContext’ could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
Models\Contactscontext.cs(7,32): error CS0246: The type or namespace name ‘DbContextOptions’ could not be found (are you missing a using directive or an assembly refembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apis.csproj]ql\apisql.csproj]
0 Warning(s)
3 Error(s)
ityFrameworkCore’ does not exist in the namespace ‘Microsoft’ (are you missing an assem
Time Elapsed 00:00:00.76 \apisql.csproj]
PS C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql> dotnet restoontext’ could not be found (are you missing a using directive or an assembly reference?re ]
Restore completed in 13.19 ms for C:\Users\Agustin\Desktop\CURSOS PROGRAMACIontextOptions’ could not be found (are you missing a using directive or an assembly refON\azure sql\apisql\apisql.csproj. .csproj]
PS C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql> dotnet build
Microsoft ® Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright © Microsoft Corporation. All rights reserved.

Restore completed in 13.67 ms for C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj.
Models\Contactscontext.cs(1,17): error CS0234: The type or namespace name ‘EntityFrameworkCore’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
Models\Contactscontext.cs(5,36): error CS0246: The type or namespace name ‘DbContext’ could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
Models\Contactscontext.cs(7,32): error CS0246: The type or namespace name ‘DbContextOptions’ could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]

Build FAILED.

Models\Contactscontext.cs(1,17): error CS0234: The type or namespace name ‘EntityFrameworkCore’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
Models\Contactscontext.cs(5,36): error CS0246: The type or namespace name ‘DbContext’ could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
Models\Contactscontext.cs(7,32): error CS0246: The type or namespace name ‘DbContextOptions’ could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Agustin\Desktop\CURSOS PROGRAMACION\azure sql\apisql\apisql.csproj]
0 Warning(s)
3 Error(s)

Hola! al instalar la Api desde el vídeo anterior note que la estructura no es la misma que la del profesor, en la ApiSQLPlatzi.csproj no se encontraba el <ItemGroup> por lo cual la agregue manualmente pero no me funciona. Alguno podría indicarme que debo hacer? Gracias!

Error:

C:\Users\cris_\OneDrive\Documents\Carrera Big data y Data scient\Programacion\ApiSQLPlatzi\ApiSQLPlatzi.csproj(12,3): error MSB4025: No se pudo cargar el archivo del proyecto. The ‘ItemGroup’ start tag on line 10 position 4 does not match the end tag of ‘Project’. Line 12, position 3.