« first day (1970 days earlier)      last day (2961 days later) » 

10:00 PM
You know how in Entity Framework you can use the Attribute to do: [Column("...")]. How could I build something similar, or are they just using the Linq ColumnAttribute?
 
do something similar in what context?
 
I'm actually okay with that solution @mikeTheLiar because then I Won't have to use my Override on SaveChanges()... Thank you for the confirmation, gonna have to dust off some old SQL parts of my brain.
 
that is just the standard ColumnAttribute from System.ComponentModel.DataAnnotations
 
I basically want to use an attribute to override whatever the name of the property is, but when I use my data reader simply use that name.
Basically my database uses the field Custom1 but really it is StoreLocationId.
 
@KyleBachmann yeah, it's not too bad. A little clunky but fairly straightforward.
 
10:02 PM
@Greg yes, but in what context? what are you using to access the data?
the EF model builder scans the metadata for the entity classes specifically looking for those attributes; just throwing random attributes in your code won't do anything if nothing is looking for them to be there.
 
I'm using SqlDataReader.
 
so you want to be able to do rdr["StoreLocationId"] and have the value actually come from Custom1 ?
 
@Greg you can just alias the column in the query
Assuming @MikeEdenfield is correct
 
if that's the case, just fix it in your query. SELECT Custom1 AS [StoreLocationId]...
 
user47589
@greg you can build your own version of ColumnAttribute, but you'll need to also make a corresponding EF convention to make EF do stuff with the attribute
 
10:06 PM
@Amy it doesn't sound like he's using EF, that's what I'm trying to clarify :)
 
user47589
ah i see
 
I'm not using Entity Framework.
This is a small console application.
 
I believe he's asking how to get a raw DataReader to behave like EF.
You should use EF for small console applications.
 
@MikeEdenfield which is probably more trouble than it's worth
 
uhh
 
10:07 PM
No, I'm asking how I can make:

[Column("Custom1")]
public string StoreLocationId {get;set; }

So, what I want in the SqlDataReader is to use the attribute rather than the property name.
 
you should use EF for {small,medium,large} {console,WinForms,WPF} applications.
 
user47589
sqldatareader doesn't care about attributes
 
user47589
it's dumb.
 
@Greg give the column Custom1 an alias in the query
 
@Greg I'm confused... SQLDataReader doesn't populate classes. it just returns values.
 
user47589
10:08 PM
that isn't meant as an insult; it really is dumb
 
@MikeEdenfield It cares about parameters.
 
sure.
 
user47589
everything cares about parameters.
 
user47589
except Ice-T. he cares about nothing.
 
well, technically it doesn't. SqlCommand does. but that's nitpicking.
so what you're really trying to accomplish is paramter renaming?
I'll be honest, I always specify all of my parameter explicitly.
 
10:09 PM
@Amy and honey badgers.
 
Yes.
 
but I'm pretty sure you can do parameter mapping, 1 sec.
 
@MikeEdenfield I would normally do that- but Custom1 is the dumbest fucking name.
 
well if the name of the parameter in your stored proc is @Custom1 then you're stuck with that as a parameter name.
 
user47589
alias the column in your sql query
 
10:11 PM
cmd.Parameters.Add("@Custom1", SqlDbType.Int).Value = foo.StoreLocationId;
 
@Amy if we get a 4th person to say it do you think it'll make a difference?
 
user47589
3 times works for beetlejuice
 
I don't think that is what he's trying to achieve either.
 
I'm not even sure what is real anymore. Much less what the problem is.
 
user47589
i thought he wanted to use an attribute to map a property to a column name
 
10:13 PM
@mikeTheLiar I know you can do that, not quite what I'm looking for. I'll figure it out, and show you my code.
 
@Greg what are you currently doing, with the admittedly stupid names? there's a bunch of different ways to do parameters with a SqlCommand
if I saw what you were doing I might know where you can alias the name.
I'm about 99% sure an attribute isn't gonna help you though
 
user47589
i'm 100% sure it won't, unless he writes the code to look for the attribute himself
 
public enum YesNo { Yes, No, MaybeIfImDrunk, NotEvenIfImDrunk }
 
user47589
i think that's reasonable. YesNo has slightly different semantics than true/false
 
10:16 PM
public enum YesNo { Yes, No, MaybeIfImDrunk, FileNotFound } FTFY
 
omg.
i just downloaded and installed the latest version of an SDK from a super major big corporation, that was just released in the past ~2 years.. and it won't build because it can't find the VS2003 MSBuild targets
2005? whatever 9.0 was
 
user47589
wow
 
ah. of course. all of the projects are those old obsolete style 2003 web projects that you can't use anymore. perfect!
 
10:32 PM
probably GAC issues
 
10:56 PM
I'm, uh
kind of shocked i can write that much code
in so many different places
and have it run perfectly on the first try
o.o
I guess it's really just CRUD at the heart, but whatever
 
If your code has been made simple enough conceptually you can write an entire application and only need to go in and change minor flaws.
 
@RoelvanUden mmm, yeah, but the design for this one is kind of a hackjob
imo
lots of disparate "frameworks" to consider
 
Then be prepared for waves and waves of issues when you least expect it.
 
i am... lol
 
11:01 PM
I feel like I'm in the eye of a hurricane
I'm just waiting to get pinged mercilessly
By the bug tracker
but... I can't find anything obviously wrong
 
WIN+R > regedit32.exe

**shudder**
 
woo 90s
chevy blazers, grunge, and COM development
i don't miss it
 
howdy
 
11:17 PM
well... my VS2015 license is expired according to my account... this is awkward...
 
oh shit son
Any thoughts on this from an American's perspective? I'm thinking of doing it after I finish up my first year as an entry level .Net dev
I'm living in the EU
 
I have to use my personal account to sign in... that is really... urgh
 
11:30 PM
@Codeman any thoughts on this program?
 
no, I am doing work stuff ;)
but generally code camps are looked down upon by companies with high standards
we like to see either a college degree or experience building systems or both. All a code camp tells me is that you were smart enough to pass a program you paid a lot of money for (they don't fail a lot of people out of those programs)
 
ok the gist of it is that they supply a visa if you can gain a 6month - year trainee ship. It's not a code camp afik
it's for entry level professional with 1yr + exp
Would you recommend applying for an internship and getting them to sort the visa? I'm not sure what the chances are of a US company hiring me with only a years experience though.
There must be loads of devs in the US already?
Forgot to mention I'm living in Ireland not he US
 
@Codeman - get me a job yet? :P
 
Hello, what is the general consensus on custom exceptions? Create one or just throw one of the existing ones with a custom message? I've never made a custom exception before, so not familiar with the pros and cons
I'm leaning towards just having a message and using one of the existing exceptions, but saw someone say that a custom exception shows the intent more
 
The question you have to ask yourself is "Why do I need a custom exception"
 
11:47 PM
I'm not entirely sure that InvalidOperationException or NotSupportedException is specific enough for what Im working on
Thinking about it I suppose NotSupported is the right choice
 
Well what are you trying to achieve?
 
@Gabe still not a manager...
 
@Codeman - LIAR
 
@BrianJ if it gets you a visa in a place you want to work, you know more about it than me :P
 
Codeman the bossman can hire anybody he wants
 
11:50 PM
Basically reading data from sensors in a system, the system supports many different manufacturers of sensors, but the thing I'm working on is only meant to be able to read from a specific manufacturer (long story) so if my code gets called to read a sensor that is not one of the supported ones I have to throw an exception
I guess NotSupported fits that now ive typed it out haha
 
Yep :)
 
Thanks :P
 
"Why do I need to do x?" is a good question to ask yourself in general? I do it daily
@Codeman s next question should be "Why do I need to hire this pleb Gabe"
The answer is obvious - you shouldn't :P
 
I'll remember that, pretty good advice haha
 
I'm hungry af...
Should I eat indian or chinese for lunch
 
11:55 PM
omg...
I'm not going to comment on this, but just use your own dirty imaginations to make jokes...
 
Erm...
NK?
:P
You know what it is tho right? @Codeman
 

« first day (1970 days earlier)      last day (2961 days later) »