Added New Property in Customer Profile causing error : Invalid column name 'MobileNo'

2 settimane tempo fa
I 'm working in Nopcommerce solution, tried to customize the customer entity by adding new property following the guidelines provided in Nop commerce developer documentation.  I have modified following files with project provided below.

Project : Nop.Core
Entity : Customer.cs
Description : Added new property for Mobile Number


Project : Nop.Data
Entity : CustomerMobileNo.cs
Description : created this class for Reverse Auto migration


Project : Nop.Admin
ViewModel : CustomerModel.cs
Description : Added the mapping property for the newly created attribute.

Project : Nop.Admin
Validator : CustomerValidator.cs
Description : Applied validation for property based on type and length

Project : Nop.Web
View : _CreateOrUpdate.Info.cshtml
Description : Applied UI changes for adding this new field.

Post to these changes when running the solution, following issue getting populated, breaking the execution.  Any help will be much appreciated.

Error  Stack Trace :

Unhandled exception. System.AggregateException: One or more errors occurred. (Invalid column name 'MobileNo'.)
---> Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid column name 'MobileNo'.
   at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__195_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at LinqToDB.Data.DataConnection.ExecuteReaderAsync(CommandBehavior commandBehavior, CancellationToken cancellationToken)
   at LinqToDB.Data.DataConnection.ExecuteDataReaderAsync(CommandBehavior commandBehavior, CancellationToken cancellationToken)
   at LinqToDB.Data.DataConnection.ExecuteDataReaderAsync(CommandBehavior commandBehavior, CancellationToken cancellationToken)
   at LinqToDB.Data.DataConnection.QueryRunner.ExecuteReaderAsync(CancellationToken cancellationToken)
   at LinqToDB.Linq.QueryRunner.ExecuteQueryAsync[T](Query query, IDataContext dataContext, Mapper`1 mapper, Expression expression, Object[] ps, Object[] preambles, Int32 queryNumber, Func`2 func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
   at LinqToDB.Linq.QueryRunner.ExecuteQueryAsync[T](Query query, IDataContext dataContext, Mapper`1 mapper, Expression expression, Object[] ps, Object[] preambles, Int32 queryNumber, Func`2 func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
   at LinqToDB.Linq.ExpressionQuery`1.GetForEachAsync(Action`1 action, CancellationToken cancellationToken)
   at LinqToDB.AsyncExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken token)
   at System.Linq.AsyncIQueryableExtensions.ToPagedListAsync[T](IQueryable`1 source, Int32 pageIndex, Int32 pageSize, Boolean getOnlyTotalCount) in E:\Development\ECommerce_Platform\GreenWay\GREENWAYSPARK_V01\src\Libraries\Nop.Data\Extensions\AsyncIQueryableExtensions.cs:line 654
ClientConnectionId:a573a780-7c3a-42cc-b301-d13dcf732e12
2 settimane tempo fa
E:\Development\ECommerce_Platform\GreenWay\GREENWAYSPARK_V01\src\Libraries\Nop.Data\Extensions\AsyncIQueryableExtensions.cs:line 654

You should verify this, as there appears to be an issue. However, in my perspective, rather than altering the default code, build a new domain for it, such as CustomerPhone Mapping.

This is advantageous to you.
2 settimane tempo fa
Or unless there was a particular reason to do the above you could have used Custom Customer Attributes to make a new field