Browse Source

DotnetCore 5.0 & Timeshare fix

master
30117125 3 years ago
parent
commit
263e4e2e9d

+ 13
- 3
UnivateProperties_API/Context/DataContext.cs View File

@@ -1,5 +1,5 @@
1 1
 using Microsoft.EntityFrameworkCore;
2
-using Microsoft.Data.SqlClient;
2
+using System.Data.SqlClient;
3 3
 using System.Linq;
4 4
 using UnivateProperties_API.Model;
5 5
 using UnivateProperties_API.Model.Banks;
@@ -13,7 +13,6 @@ using UnivateProperties_API.Model.Properties;
13 13
 using UnivateProperties_API.Model.Region;
14 14
 using UnivateProperties_API.Model.Timeshare;
15 15
 using UnivateProperties_API.Model.Users;
16
-using Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal;
17 16
 
18 17
 namespace UnivateProperties_API.Context
19 18
 {
@@ -26,11 +25,22 @@ namespace UnivateProperties_API.Context
26 25
             {
27 26
                 if (extention.GetType().ToString() == "Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal.SqlServerOptionsExtension")
28 27
                 {
29
-                    connectionString = ((SqlServerOptionsExtension)extention).ConnectionString;
28
+                    //connectionString = ((SqlServerOptionsExtension)extention).ConnectionString;
29
+                    connectionString = ((Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal.SqlServerOptionsExtension)extention).ConnectionString;
30 30
                 }
31 31
             }
32 32
         }
33 33
 
34
+        public DataContext()
35
+        {
36
+        }
37
+
38
+        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
39
+        {
40
+            optionsBuilder.EnableSensitiveDataLogging();
41
+            
42
+        }
43
+
34 44
         #region User
35 45
         public virtual DbSet<Agency> Agencies { get; set; }
36 46
         public virtual DbSet<Agent> Agents { get; set; }

+ 0
- 1
UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs View File

@@ -103,7 +103,6 @@ namespace UnivateProperties_API.Model.Timeshare
103 103
 
104 104
         [ForeignKey("Status")]
105 105
         public int StatusId { get; set; }
106
-
107 106
         public WeekType WeekType { get; set; }
108 107
         public string WeekStatus { get; set; }
109 108
         public bool Publish { get; set; }

+ 2
- 2
UnivateProperties_API/Repository/Users/AgentRepository.cs View File

@@ -2,7 +2,6 @@
2 2
 using System;
3 3
 using System.Collections.Generic;
4 4
 using System.Linq;
5
-using UnivateProperties_API.Containers.Users;
6 5
 using UnivateProperties_API.Context;
7 6
 using UnivateProperties_API.Model.Users;
8 7
 
@@ -43,7 +42,8 @@ namespace UnivateProperties_API.Repository.Users
43 42
             /*if (_dbContext.Agents.Any(a => a.AgencyId == null))
44 43
             {
45 44
                 item.AgencyId = 10;
46
-            }*/
45
+            }*/            
46
+            
47 47
             var agent = _dbContext.Agents.Where(x => x.UserId == item.User.Id).FirstOrDefault();
48 48
             var individual = _dbContext.Individuals.Where(x => x.UserId == item.User.Id).FirstOrDefault();
49 49
             var user = _dbContext.Users.Where(x => x.Id == item.User.Id).FirstOrDefault();

+ 4
- 3
UnivateProperties_API/UnivateProperties_API.csproj View File

@@ -2,7 +2,7 @@
2 2
 
3 3
   <PropertyGroup>
4 4
     <TargetFramework>netcoreapp5.0</TargetFramework>
5
-    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
5
+    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
6 6
     <TargetLatestRuntimePatch>false</TargetLatestRuntimePatch>
7 7
     <UserSecretsId>af6d5f9c-a077-4393-8907-888822f3e809</UserSecretsId>
8 8
   </PropertyGroup>
@@ -20,8 +20,9 @@
20 20
     <PackageReference Include="Microsoft.AspNetCore.App" />
21 21
     <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.3" />
22 22
     <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
23
-    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.5" />
24
-    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.5" />
23
+    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
24
+    <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.0" />
25
+    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
25 26
     <PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="5.0.1" />
26 27
     <PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
27 28
     <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4" />

Loading…
Cancel
Save