|
I'm trying to learn nHibernate to replace a home grown data access layer who's developer has left the company. This is really, really confusing. Even the getting started examples are hard to follow because they try to throw about a million new concepts at you at once. Any sage advice for picking this up?
|
# ¿ Apr 21, 2009 18:26 |
|
|
# ¿ Apr 28, 2024 01:44 |
|
Begby posted:Have you considered learning it in Java first? There is a lot more documentation available for that. After you learn the theory applying it to .NET shouldn't be that difficult. I'd have to learn Java before learning it in Java, which doesn't seem like it'd be a big upgrade. Kekekela posted:Most .NET DAL's are not ORM-based and are very stored proc heavy, which makes switching to nHibernate a pretty big conceptual switch unless you're going to try to use it to fit the old DAL pattern which I don't think is a good idea. I'd suggest reading up on the ORM pattern of data access if you aren't familiar with it already and making sure this is the way you want to go. Fowler's Patterns of Enterprise Application Architecture has a good section on this, and I think the nHib docs probably do as well (or at least the Hib docs would), or just go to wikipedia. The DAL we're working with now is built on a program that reads a datatable and spits out a custom .net class that can read/write data to and from it, but it has no understanding of relationships and has poor performance. It also makes absolutely no use of generics where generics make sense, such as for returning a collection of the rows from a table as a list or dictionary, instead having it's own collection and keyed collection classes with massive overhead. And the save routine updates the entire row regardless of what's actually changed. There are a million things wrong with it and I've been trying to fix them, but it seems stupid when there are open source alternatives that can do the same thing with better performance. ray2k posted:Never used it professionally but I've toyed with it a bit. I found Steve Bohlen's Summer of NHibernate really useful. There's also some quick tutorials on Dimecasts, and recently Ayende has blogged about the multitude of mapping options. Thank you, I'm gonna look into these.
|
# ¿ Apr 22, 2009 21:44 |
|
You could do that with a control that contains a repeater quite easily, or with a asp:table if you prefer.
|
# ¿ May 2, 2009 14:25 |
|
Am I missing something? I'm using NHibernate and thus I've got an object that has a ISet of another object in it. I was under the impression that ISet would prevent me from adding the same other object twice, as long as I had a working equals on the other object- but equals never gets called and I'm able to add multiple other objects no problem. I'm using the HashedSet implementation from Iesi.Collections- so I'm guessing that I need to implement GetHash on my objects in order for it to properly identify that an other object is in the set. Is there an easier strategy for this problem? I don't want to have to go around implementing gethash and equals on all my custom objects.
|
# ¿ May 5, 2009 16:32 |
|
shrughes posted:When you override Equals, you must override GetHashCode in a consistent manner. This is not supposed to be hard. Yeah I just did some reading for other examples of people implementing GetHashCode and i realized how easy it can be. The first few examples I saw were all kinds of complicated.
|
# ¿ May 5, 2009 18:06 |
|
nhibernate requires virtual events and those don't exist in vb.net why didn't anyone warn me oh god? Now I have to teach myself c#. I've been meaning to switch for a while now, so woohoo.
|
# ¿ May 6, 2009 23:34 |
|
shrughes posted:Pardon my ignorance; what is a virtual event? an event that can be overridden by an inheriting object.
|
# ¿ May 7, 2009 12:14 |
|
Nurbs posted:In order to properly get the answers I want while iterating through the Collection<QuestionBase> I would need to cast the given object in order to retrieve it's Answer value. Or, I figure out a way for the QuestionText and QuestionBoolean child objects (TextBox and CheckBox) to feed their values into the Answer property Why do you have to cast them? foreach(QuestionBase QB in yourContainerObject) theAnswer = QB.Answer should work fine, as long as they override the answer property of the base class.
|
# ¿ May 8, 2009 12:42 |
|
After 4 days of using C# the only thing I miss about VB.net is the My namespace. Remind me again why C# doesn't have that?
|
# ¿ May 10, 2009 03:31 |
|
biznatchio posted:It does, kinda. Yeah I saw that but the parts of My that I used most often where under My.User, My.Application, My.Settings, ect, none of which are covered there...
|
# ¿ May 11, 2009 22:14 |
|
How do I check if an NHibernate collection object is a lazy loading proxy or a fully loaded object? I have some code I want to run on a classes child after this class's children are loaded, but I don't want that code to go ahead and load the children. Unfortunately the code needs to access the parent item's children collection to get some siblings of each child, which leads to a "illegal access exception" until lazy loading is complete. What I'm looking for is a way to test if a collection has been loaded. Edit: Asked Steve Bohlen on Twitter- NHibernateUtil.IsPropertyInitialized Dietrich fucked around with this message at 20:55 on May 12, 2009 |
# ¿ May 12, 2009 16:29 |
|
This is freaking driving me insane, so I'm cross posting this from Stack Overflow. I'm trying to to setup Memcached 2nd level caching with NHibernate. I've followed what documentation I could find, including downloading the project from SVN and looking at how it is configured in their test project, and ended up with this in my app.config. code:
I have three projects, .UI, .Core, and .Data - the app.config is for .UI and .Data is where `SessionFactory` gets built and the code that wants to load this configuration section is launched. .Data has the `Nhibernate.Caches.Memcache` reference, and I've tried adding it to .UI, however that did not solve the issue. What is incorrect about this configuration? Or perhaps is it something about my project? Does anyone have any experience at all with `NHibernate.Caches.MemCache`? There is not much information about it to be found via Google.
|
# ¿ May 29, 2009 18:21 |
|
Why don't you add some events to the child form and have the parent handle those? That's how I typically do it, it makes the child form more reusable.
|
# ¿ May 31, 2009 15:15 |
|
uXs posted:And that just works a lot better. DataSets are cumbersome to use and really awkward to maintain. I've made a few apps with them, and I didn't like it. Ripping them out and using plain objects instead is much nicer. I created a data-table proxy generic class that takes a collection<T> and a collection<string> of properties you want to be columns in your data table and spits out a system.data.datatable with a row for each object in the collection. It uses reflection to find the method info for the properties by name and then caches the method info, so it's not too bad on the old performance front. Datatables are what reporting loves.
|
# ¿ Jun 7, 2009 14:15 |
|
Anyone messed with Code-Name Velocity yet?
|
# ¿ Jun 12, 2009 11:35 |
|
I have just invented a generic class that will take an List of anything and output a data table containing whatever the hell you want from that list. You define the desired columns by building a Dictionary<string, Func<T, object>>, which means it takes lambda expressions. I'm posting this for two reasons. 1- It's freaking awesome and I think you guys will like it. 2- I would like to make it faster and was hoping for some suggestions. code:
code:
|
# ¿ Jun 29, 2009 21:46 |
|
Ah thanks, that was some leavings from my last implementation when I was using a custom key-value pair class and addressed the columns collection via index.
|
# ¿ Jun 29, 2009 22:36 |
|
dwazegek posted:Why are you iterating through columns manually, and not with a foreach loop? You're also not disposing the enumerators after you're done with them. I don't think you can iterate though a Dictionary<Tkey, TValue> manually. Aside from that, great stuff and I'll use the heck out of it. Edit: but you can cast the .keys and .values collection to an array and then step though that instead, which I think would be higher performance, trying that now. Dietrich fucked around with this message at 13:38 on Jun 30, 2009 |
# ¿ Jun 30, 2009 11:59 |
|
The Noble Nobbler posted:Not bad, but you can do this with a way smaller function and Linq. I can show you if you're interested I'm listening.
|
# ¿ Jul 6, 2009 12:01 |
|
The end result of all this poo poo is a form where the user's can pick what columns they want, and then a data table is filled with the results. The columns, in this case, are generally results of a function ran against an object with a fixed parameter (per column). Column 1 might display the result of obj.getValue(1) while column 2 might be obj.getValue(15), where 1 and 15 relate to the primary key of a table that stores all the column definitions. The data being displayed is super-normalized, let's just put it that way. I can post the ERD if you want to gently caress your mind right out of your head.
|
# ¿ Jul 6, 2009 19:21 |
|
Check out Expresso for all your RegEx creation/checking needs. It provides a nice little logic tree that really illustrates what your regex is being interpreted to mean.
|
# ¿ Jul 10, 2009 20:39 |
|
Wouldn't it be better to combine the list of used TCP and UDP Ports and then step though them and return the first open pair you see that meets your needs?code:
Edit2: god why do I keep tweaking this?! Dietrich fucked around with this message at 13:49 on Jul 14, 2009 |
# ¿ Jul 14, 2009 12:34 |
|
Now you're playing with power. Nice.
|
# ¿ Jul 14, 2009 14:00 |
|
Postsharp is your lover and your best friend when it comes to poo poo like that.
|
# ¿ Jul 16, 2009 00:02 |
|
I've got a Datatable object that I would like to make a spreadsheet in a .xls file. What is the best way to make this happen?
|
# ¿ Sep 28, 2009 17:41 |
|
Earlier this year I was learning nhibernate and was pointed to the Summer of NHibernate series which was absolutely invaluable. Now I am interested in picking up WPF- is there any tutorial for this which is on par with Summer of NHibernate?
|
# ¿ Oct 26, 2009 14:51 |
|
In a Winforms MDI application, how do I figure out which control on which form has focus?
|
# ¿ Oct 27, 2009 15:19 |
|
I just posted my awesome data table proxy class on codeplex. I don't know how specific the need for this kind of object is, but I use it all over the freaking place along with DataGrids for easily presenting tabular data. Combined with lambda expressions you can very quickly do specific aggregations of child object collections and pretty much anything the gently caress else you want to do. http://datatableproxy.codeplex.com/ Enjoy. Rate it if you like it.
|
# ¿ Nov 19, 2009 21:11 |
|
I don't really have full understanding of either library you are using, but can filehelpers take a datatable object and convert it to a .csv file? If so perhaps you can use my DataTableProxy thing instead of nvelocity for a no nonsense "take these objects and format an output like this" solution. Sorry for the shameless plug.
|
# ¿ Nov 23, 2009 18:12 |
|
Just to share a nice little .dll I've found, MyXls has to be the easiest to use library for creating .xls documents I've ran across. No need for excel interop libraries or code templates or reflection or any of that jazz, just a straight forward API that creates a .xls document that you can then do whatever the hell you want with. Here is a quick and easy sub routine that uses this to create and save a .xls containing all the data from a datatable object. code:
|
# ¿ Nov 30, 2009 21:50 |
|
Ok I'm trying to teach myself xaml and WPF, and this data binding poo poo has my head spinning. Anyone got a good tutorial or resource on getting this poo poo done? As usual MSDN's tutorials skip about a hundred steps.
|
# ¿ Dec 5, 2009 16:16 |
|
Log4net- who uses this? How do I go about quickly picking up how it works? Does anyone have some pre rolled logger classes that kick rear end to use?
|
# ¿ Jan 18, 2010 04:37 |
|
Make a button that does that once, then make all your buttons inherit from that button.
|
# ¿ Feb 24, 2010 21:59 |
|
CRIP EATIN BREAD posted:I'm developing an app in c#, however this one is a bit more involved than what I've done in the past with the .net framework. It's a form based application, and by default it looks like every bit of information I've seen has the creation and navigation of multiple forms handled by the forms themselves. Is this really the standard practice, or is it just because the default code generated by the project wizards tends to lean in this direction? Sweet merciful crap do not do your application that way.
|
# ¿ Apr 27, 2010 15:24 |
|
jarito posted:Is there an accepted way to do this? I typically do web development, but I would be interested in what would be considered best practice here. Create a singleton shell class that you can issue commands to- ie: Shell.OpenOrdersForm That way when you get all fancy with needing to make sure a form can only be opened once or with switching forms to an active window in order to prompt it's easy to do, and you can obfuscate the various form construction methods from other forms so that you only have to change things in one place.
|
# ¿ Apr 29, 2010 14:39 |
|
Var is awesome. When I change the return type of something from, say, list<t> to ienumerable<t>, IT KEEPS WORKING.
|
# ¿ May 1, 2010 12:11 |
|
Fire Storm posted:Here's a question I feel stupid for asking, but... Do not use either of those, they are terrible bases for games. Download XNA.
|
# ¿ Jun 30, 2010 14:55 |
|
EF is really just Linq to SQL made usable for anything more complex than a single form. That being said, use NHibernate with Fluent mappings.
|
# ¿ Nov 19, 2010 15:39 |
|
Why are your UI and your DB classes the same? You either designed your DB around your UI's concerns or designed your UI around your DB's concerns.
|
# ¿ Nov 19, 2010 18:20 |
|
|
# ¿ Apr 28, 2024 01:44 |
|
highme posted:Next question time, a combination of reference material written for C# and lecture slides that are a bit disjointed, has left me a bit confused on the steps to turn the list created previously into a searchable hashtable. Do they have to be "hashtables"? Because a Dictionary<tk, tv> is pretty much what you want. Although in visual crappy syntax that would be Dictionary(of tk, tv)
|
# ¿ Feb 10, 2011 13:46 |