Git Product home page Git Product logo

Comments (14)

TitoCalleros avatar TitoCalleros commented on May 16, 2024

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.

christiandelbianco avatar christiandelbianco commented on May 16, 2024

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.

TitoCalleros avatar TitoCalleros commented on May 16, 2024

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.

TitoCalleros avatar TitoCalleros commented on May 16, 2024

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.

christiandelbianco avatar christiandelbianco commented on May 16, 2024

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.

christiandelbianco avatar christiandelbianco commented on May 16, 2024

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.

TitoCalleros avatar TitoCalleros commented on May 16, 2024

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:
image

The column FechaHora is my problem, because when I recieved the changed record, I receive only this:
image

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.

TitoCalleros avatar TitoCalleros commented on May 16, 2024

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);

image

I recieve this value:
image

Do you have any idea where is the problem?

from monitor-table-change-with-sqltabledependency.

christiandelbianco avatar christiandelbianco commented on May 16, 2024

working on

from monitor-table-change-with-sqltabledependency.

christiandelbianco avatar christiandelbianco commented on May 16, 2024

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.

TitoCalleros avatar TitoCalleros commented on May 16, 2024

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.

christiandelbianco avatar christiandelbianco commented on May 16, 2024

It should be fixed.

Assuming your table is:

2018-05-30 at 15-11-30

2018-05-30 at 15-11-59

Your C# model property mapping FLOAT table column, must be a decimal:

2018-05-30 at 15-13-37

I get:

2018-05-30 at 15-14-44

Fix available with version 7.4.0.

from monitor-table-change-with-sqltabledependency.

TitoCalleros avatar TitoCalleros commented on May 16, 2024

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.

christiandelbianco avatar christiandelbianco commented on May 16, 2024

As soon as integration test finish, i will be publich version 7.4.0

from monitor-table-change-with-sqltabledependency.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.