Questions tagged as 'c#'

3
answers

Which application layer is geared towards processing of broader and more complex business rules?

I have been reading some questions and answers about the MVC standard and I have seen that it is correct to treat business rules in the Controller layer, for example: Verify that a record already exists in the database before persisting i...
asked by 08.10.2014 / 01:41
1
answer

How to handle duplicate key error?

How do I handle duplicate key errors? I need to display message to user that "Item is already registered" Something like this: try{ //tenta inserir no Banco de Dados context.Produto.Add(_produto); context.SaveChanges(); }catch(exceç...
asked by 02.10.2015 / 01:26
1
answer

What is CultureInfo.InvariantCulture?

I have installed Resharper and in this section x.Id.ToString() it suggests changing to x.Id.ToString(CultureInfo.InvariantCulture) . What is CultureInfo.InvariantCulture and why is it better?     
asked by 06.10.2015 / 20:03
2
answers

Java 8 "default method" versus C # "extend method"

Java 8 introduces the concept of "standard method" to allow adding new functionality to an interface. C # provides "extension methods" that allow you to "add" methods (features) to existing types. Considering how they are implemented by th...
asked by 02.04.2016 / 01:05
2
answers

How to save a cascaded collection in nhibernate without putting circular reference?

Always when I try to save an object with a collection of data mapped as HasMany I have to put a circular reference so that NHibernate can save this object cascade. For example I have the following mapping of the parent class. public...
asked by 12.12.2013 / 20:49
1
answer

Generate classes with XSD or import WSDL [ANS / TISS]

ANS provides the .XSD , and .WSDL files for TISS implementation. S and I generate the code by .XSD, I have the classes structured correctly. Example: namespace TissV3 { class Cabecalho { ... } class...
asked by 11.06.2018 / 16:29
1
answer

Debug and Release mode in Visual Studio, what's the use?

In my Visual Studio I noticed that there are two settings that I can not understand what they are for, they are Debug and Release is part of the Solution Confugurations option. Could someone explain to me what is the purpose of these two...
asked by 02.11.2015 / 14:48
1
answer

Concat () VS Union ()

What is the difference between Concat() and Union() ? When to use Concat() and when to use Union() ? Can only be used in list ?     
asked by 19.03.2015 / 11:47
2
answers

Foreach or lambda in lists

What do I get the best performance to get the value of a data in a list? Do foreach or lambda (when possible, of course)? I can have this: foreach(var i in lista) { var teste = i.NmCampo; } Or this: var teste = lista.Select(campo...
asked by 11.03.2015 / 13:09
3
answers

How to give a Regex before a string? And select?

What I need to do is this: let's assume the string is - > : . However, I want to select "only" the string before : using Regex . To get clearer: " select this word : another word here" Remembering that :...
asked by 09.01.2018 / 18:44