Questions tagged as 'c#'

1
answer

How to configure Context to put the plural table name in pt-BR?

I'm in an ASP.NET MVC 5 application, setting up a DbContext class. When EF generates the database, the tables for the application objects are getting the plural names in English. For example: public System.Data.Entity.DbSet<Teste....
asked by 15.07.2016 / 18:39
1
answer

Entity Framework 6 relationship

I have a class where I need to have 2 different relationships with the same table. public class Usuario { public int Naturalidade {set;get;} public int CidadeEndereco {set;get; } public class Cidade { public int Id {se...
asked by 17.06.2016 / 21:10
2
answers

How to convert a DataSet to Int32?

I'm having a problem converting an information that is coming from my database to a variable of type Int32 . When I do the select max(cur_id) from tbl_curriculo; I send the id information straight to a Dataset which I call...
asked by 18.06.2016 / 07:07
2
answers

Change color of an Error Message using Annotation

Where can I change the color of this ErrorMessage ?     
asked by 07.10.2016 / 01:03
1
answer

Regular Expression Regex

I want to make patterns like this: [a-z]+[acentos] || [a-z]+[acentos]+[espaço]+[a-z]+[acentos] || [a-z]+[acentos]+[-]+[a-z]+[acentos] To be able to register a word, you must be within one of these patterns. For example: téstê || téstê...
asked by 05.10.2016 / 17:24
1
answer

How to know which keys are pressed in C # ConsoleApp and set events

How can I "read" which key is pressed and set an event for that key if it is pressed. Example: if F1 is pressed Sum, F2 subtracts and so goes I found in the C # help site this example, but I did not understand how it works: using System;...
asked by 10.05.2016 / 20:13
2
answers

Get elapsed time of a string

I wanted to calculate the time now with what I get from a string like this: 2016-04-16T15:55:53Z But the time is three hours higher than our spindle, I wanted some output like: Já se decorreu 0 horas, 0 minutos e 0 segundos...     
asked by 16.04.2016 / 20:09
1
answer

New position X and Y depending on direction and distance?

I'm doing a mini shooting game in XNA but I can not figure out how to calculate the following: Knowingthepositionofthecenteroftheimage,thedirectioninwhichitispointingandthedistancebetweenthecenterandthe"nozzle" of the weapon, how to know the...
asked by 21.09.2016 / 12:27
1
answer

Entity FrameWork (ORM) and DropDownList Html

I have two mapped models that will work like this: The model Afaze will have a ComboBox (DropDownList) that will make the categories available to the user to select, however these categories are registered by the same, so in the source I h...
asked by 24.09.2016 / 00:42
1
answer

How to create a method that takes only one string parameter and returns a generic type? .NET MVC

How could I create a method that does not need to receive a type as a parameter, only a string , but would return a type? As for example: public static T Guard(string guard_name) where T : class, IAuth { return (T)Activator.Create...
asked by 30.06.2016 / 15:19