Comments (14)
I was looking at code, and I asume the main cause of this problem is in RecordChangedEventArgs, in GetValueObject(PropertyInfo propertyInfo, string value), becuase it uses the CultureInfo for the conversion (return Double.Parse(value, this.Culture);, but I don't know where change this configuration only for SqlTableDependency.
from monitor-table-change-with-sqltabledependency.
Hi, there is a property
/// <summary>
/// Gets or sets the culture information five letters iso code.
/// </summary>
/// <value>
/// The culture information five letters iso code.
/// </value>
public string CultureInfoFiveLettersIsoCode { get; set; } = "en-US";
can you try to use it ?
tell me if is ok.
from monitor-table-change-with-sqltabledependency.
Hi, sorry for respond until now,
I think that this doesn't resolve my problem, My database has a double column with at least 10 decimals, and there isn´t a culture info with this configuration.
from monitor-table-change-with-sqltabledependency.
Hi, thanks for reopen this issue. What do you think of create an inexistent culture info (maybe an "xx-xx") and in the switch of the GetValueObject function replace return Double.Parse(value, this.Culture) with a function like this:
private ConvertDoubleValueObject(string value, string cultureInfo)
{
if (cultureInfo == "xx-xx")
return Double.Parse(value);
return Double.Parse(value, this.CultureInfo);
}
from monitor-table-change-with-sqltabledependency.
Sound a good idea.
Just one thing: can you download source code, apply your fix and run all integration tests?
If all if fine, i integrate your fix
from monitor-table-change-with-sqltabledependency.
Hi.
I change the property
public string CultureInfoFiveLettersIsoCode { get; set; } = "en-US";
to
public CultureInfo CultureInfo{ get; set; };
Now, setting the .NumberFormat of the specified culture info, you should be able to set number of decimals.
from monitor-table-change-with-sqltabledependency.
Hi Christian,
I was testing this upgrade, and i observe the same behavior,
var mapper = new ModelToTableMapper<EventoGIL>();
var updateOfModel = new UpdateOfModel<EventoGIL>();
var cuInfo = new System.Globalization.CultureInfo("es-mx");
Dependency = new SqlTableDependency<EventoGIL>(Conexion, Tabla, null, null, ColumnasMapeadas, null, DmlTriggerType.All);
cuInfo.NumberFormat.NumberDecimalDigits = 10;
cuInfo.NumberFormat.CurrencyDecimalDigits = 10;
cuInfo.NumberFormat.PercentDecimalDigits = 10;
Dependency.CultureInfo = cuInfo;
In my Database, I have this records:
The column FechaHora is my problem, because when I recieved the changed record, I receive only this:
So, I think the problem is not in
protected virtual object GetValueObject(PropertyInfo propertyInfo, string value){}
I think the problem could be generated from the MessageBag received.
I was checking your CultureInfoTest, but it only test for DateTimeFormat, but it doesn't test for single or double type columns.
from monitor-table-change-with-sqltabledependency.
I confirm that is not only a problem with the cultureInfo. I changed GetValueObject(PropertyInfo propertyInfo, string value) function, removing cultureInfo for single, double and decimal column, and the problem continue:
case TypeCode.Single:
return float.Parse(value);
//return float.Parse(value, base.CultureInfo);
case TypeCode.Double:
return double.Parse(value);
//return double.Parse(value, base.CultureInfo);
case TypeCode.Decimal:
return decimal.Parse(value);
//return decimal.Parse(value, base.CultureInfo);
Do you have any idea where is the problem?
from monitor-table-change-with-sqltabledependency.
working on
from monitor-table-change-with-sqltabledependency.
I have checked. As you can see from this video, all works fine for me.
Can you send me the script for creating your table and a zip file containing a solution that reproduce this error?
Regards
from monitor-table-change-with-sqltabledependency.
Hi Christian,
I saw the video, and check that you use a decimal column type. Could you use a float column type instead a decimal, I think the problem is related with the floating point variables.. You don't need to create a video.
And with your request, I need to create other project and DB, because it's strictly confidential because is for an utility company, and information it's a national secutiry issue. So let me check.
And again, thanks for all the time you spend (I know, it's time invested), but thanks.
from monitor-table-change-with-sqltabledependency.
It should be fixed.
Assuming your table is:
Your C# model property mapping FLOAT table column, must be a decimal:
I get:
Fix available with version 7.4.0.
from monitor-table-change-with-sqltabledependency.
Thank you for all your help Christian,
I'll be testing this temporal fix in a while, but a think it should work. Thanks a lot.
I'm surprised that nobody would have presented this problem before (sorry for my english, it's not my natural language).
from monitor-table-change-with-sqltabledependency.
As soon as integration test finish, i will be publich version 7.4.0
from monitor-table-change-with-sqltabledependency.
Related Issues (20)
- sqltabledependency trigger on my table “locks” all upcoming DML operations HOT 4
- Use DataTable or DataRow
- Permission error
- SqlTableDependency event trigger is not working if running as a BackgroundService HOT 1
- I cannot find a database table named "Table name"
- Nested object
- Returning dynamic Object / ExpandoObject
- Monitor multiple tables HOT 2
- Incorrect syntax near 'POISON_MESSAGE_HANDLING'
- The event object always returns null
- Design question - feasible to use in Azure DevOps and PowerShell script?
- OnChanged doesn't work after some time
- Text column type is not an supperted by SqlTableDependency
- Old stuff. Anyone maintaining this or new approach? HOT 7
- Detecting only Insert and update but not the Delete
- Is there a limit to the number of fields that can be declared in the C# class for trigger detecting?
- Keyword 'trust server certificate' not supported HOT 1
- Could not load file or assembly 'TableDependency.SqlClient, Version=8.5.8.0 HOT 1
- Delete command not working
- .net 8.0.100-rc.2.23502.2 error for SqlTableDependency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monitor-table-change-with-sqltabledependency.