This is my first time writing you, first of all this is a great product, im facinated with EntitySpaces.
EntitySpaces Version # 2008.1.0623.0
MyGeneration Version # 1.2.0.7
Database: MSSQL
I need a calculated column, i added it like this:
Code:
1 if (this.Table != null)
2 {
3 if (!Table.Columns.Contains("Minutos"))
4 Table.Columns.Add("Minutos", typeof(System.Decimal));
5
6 TimeSpan dif;
7 foreach (CcOrden orden in this)
8 {
9 if (orden.FecEntregaT.HasValue)
10 dif = orden.FecEntregaT.Value - orden.FechaIngreso.Value;
11 else
12 dif = DateTime.Now - orden.FechaIngreso.Value;
13
14 orden.SetColumn("Minutos", dif.TotalMinutes);
15 }
16 }
So, when i try to Save(), it throws me this error:
Code:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="EntitySpaces.SqlClientProvider"
StackTrace:
at EntitySpaces.SqlClientProvider.Shared.BuildDynamicUpdateCommand(esDataRequest request, List`1 modifiedColumns)
at EntitySpaces.SqlClientProvider.DataProvider.SaveDynamic(esDataRequest request)
at EntitySpaces.SqlClientProvider.DataProvider.EntitySpaces.Interfaces.IDataProvider.esSaveDataTable(esDataRequest request)
at EntitySpaces.Interfaces.esDataProvider.esSaveDataTable(esDataRequest request, esProviderSignature sig)
at EntitySpaces.Core.esEntityCollection.SaveToProviderInsertsUpdates(esSqlAccessType sqlAccessType)
at EntitySpaces.Core.esEntityCollection.SaveToProvider(esSqlAccessType sqlAccessType)
at EntitySpaces.Core.esEntityCollection.Save(esSqlAccessType sqlAccessType)
at EntitySpaces.Core.esEntityCollection.Save()
at MayorSys.CcOrdenCollection.Grabar() in C:\Datos\Sistemas\MayorSysCompleto\DatosMayorSys\CallCenter\Custom\CcOrdenCollection.cs:line 55
at MayorSys.CallCenter.OrdenesAnteriores.simpleButton2_Click_1(Object sender, EventArgs e) in C:\Datos\Sistemas\MayorSysCompleto\MayorSysWin\CallCenter\OrdenesAnteriores.cs:line 93
at System.Windows.Forms.Control.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MayorSys.Program.Main() in C:\Datos\Sistemas\MayorSysCompleto\MayorSysWin\Program.cs:line 20
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I tried removing the agregated column first:
Code:
1 if (this.Table != null)
2 {
3 if (Table.Columns.Contains("Minutos"))
4 Table.Columns.Remove("Minutos");
5
6 this.Save();
7 }
i noticed that if i comment:
orden.SetColumn("Minutos", dif.TotalMinutes);
It works fine, but that was the porpouse of adding the column in the first place,
im stuck>
Fradique Lee