Click here to Skip to main content
15,885,872 members

Comments by NaVeN Kumar (Top 48 by date)

NaVeN Kumar 21-Aug-17 8:35am View    
Sorry. I have updated the question. Please let me know if Im not clear.
NaVeN Kumar 12-Jan-17 5:29am View    
If end user passes as 0110 it will take 72. Can we prevent that in any other way?
NaVeN Kumar 18-Dec-16 10:35am View    
Hi Kornfeld, I have verified and found some articles where they have created like below.. Is that correct way? will it causes any performance issue?

[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class Precision : Attribute
{
public byte precision { get; set; }
public byte scale { get; set; }

public Precision(byte precision, byte scale)
{
this.precision = precision;
this.scale = scale;
}

public static void ConfigureModelBuilder(DbModelBuilder modelBuilder)
{
modelBuilder.Properties().Where(x => x.GetCustomAttributes(false).OfType(Precision).Any()).Configure(c => c.HasPrecision(c.ClrPropertyInfo.GetCustomAttributes(false).OfType(Precision).First().precision, c.ClrPropertyInfo.GetCustomAttributes(false).OfType(Precision).First().scale));
}
}

Then in your OnModelCreating simply add the following:


Precision.ConfigureModelBuilder(modelBuilder);

And in your Model simply add the Precision attribute to any decimal properties.


[Precision(18, 9)]
public decimal? Latitude { get; set; }

NaVeN Kumar 9-Dec-16 4:54am View    
I am not sure whether my thought is best solution or not. I will try it and post.
NaVeN Kumar 25-Jul-14 4:34am View    
Yes It worked when I used

Directory.GetFiles(directoryPath, "*", System.IO.SearchOption.AllDirectories);

Thank you so much... :)