Handle Property Mappings To Other Domain Classes That Aren't Yet Mapped With NHibernate?
Sep 8, 2010
I'm working on a project to replace ADO.NET data access logic using NHibernate where we're not able to map the entire domain model at once. This means we'll have domain classes with property mappings to other domain classes that aren't yet mapped with NHibernate.
Consider a Person class with an Address property (Address being a domain object without an NH mapping and Person being the class I'm mapping). How can I include Address in the Person mapping without creating an entire mapping for Address? Is it possible to call legacy (ADO.NET) data access logic from a custom PropertyAccessor? If so, is it reasonable?
*I asked this within another question here but didn't get a response. I'm hoping to get one in a more concise question.
View 1 Replies
ADVERTISEMENT
Dec 21, 2010
Well i have been fighting with this for a little bit now, and i can't seem to find a solution for something it should be really simple. I got a class ( really simple class ) i got the hbm.xml ( SET AS EMBEDDED RESOURCE ) i got the config file set for SQLite but i still get the [Class] Is not mapped.Here is where the error comes up, when i run this:
Public Sub LoadCentersFromDatabase()
Try
Dim session As ISession = OpenSession()
Dim query As IQuery = session.CreateQuery("from Center")
[code]....
View 1 Replies
Sep 30, 2010
Having successfully tried out nHibernate, I would now like to try using Fluent for mapping. My main project is in vb.net but I would really like to use c# for the mappings since the lambda expression capability makes it much cleaner. Can you have a separate project/assembly for your mapping files without creating a circular dependency with domain objects?
View 2 Replies
Dec 2, 2009
Having successfully tried out nHibernate, I would now like to try using Fluent for mapping. My main project is in vb.net but I would really like to use c# for the mappings since the lambda expression capability makes it much cleaner. Can you have a separate project/assembly for your mapping files without creating a circular dependency with domain objects?
View 1 Replies
Apr 21, 2012
I am trying to learn OOD/OOP and read on the net that I am not supposed convert SQL tables into classes. But I cannot find an explanation why not to do it or which tables to skip. So I made an web application based on the below diagram. It works perfectly well. But I do not use OO. which table should not be mapped into a class and why not. do not use LINQ or NHibernate, etc as I do not understand them. I just need to understand the OOD.
View 2 Replies
May 23, 2011
I have issue with a Nhibernate projection list, It keeps saying it Could not find a setter for property 'Commname' in class 'Label6.Domain.Product' or could not resolve property "pl.commname"
the property "commname" is a part of the object productslangs.
My product object looks like this:
Public Overridable Property Latinname() As System.String
Get
Return _Latinname
End Get
Set(ByVal value As System.String)
[Code] .....
View 1 Replies
Nov 4, 2011
The tables described herein both utilize composite keys. I have a parent table that stores eligibility information per "case". The child table stores eligibility information regarding each individual associated with the case. The child records are differentiated by pin number to make them unique in the child table only.
I am using NHibernate v3.1 with Fluent NHibernate v1.2, both acquired via NuGet packages. The entities are mapped in using the Fluent NHibernate auto-mapper functionality. Any custom mapping is done in the mapping override method for each entity.
Another thing to know is that these tables do not have a "primary key" defined in DB2. They only have "unique keys", which are what you see in the composite key definition below (see code).
T0026_AG_ELIG is the name of the parent table and the corresponding POCO class.
T0265_AG_IN_ELIG is the name of the child table and the corresponding POCO class.
Problem:
The problem is that when I execute the query, all the data is queried, the parent record is successfully mapped to the class, but the returned child rows do not map into the collection on the parent class. NHibernate does generate the queries for the parent and child data. When I execute my own query against the database, the correct data for the conditions does come back. For some reason, the child records are just not being bound to the property on the parent (T0026) class.
Question:
What do I need to do to get the multiple rows coming back from T0265_AG_IN_ELIG to map to their corresponding class and load properly into the specified collection property on the parent class (T0026_AG_ELIG)?
Collection Property of Parent (T0026_AG_ELIG):
Public Overridable Property IndividualEligibilityRecords As IList(Of T0265_AG_IN_ELIG)
Mapping Override for Parent (T0026_AG_ELIG):
mapping.CompositeId() _
[Code].....
View 2 Replies
Mar 10, 2010
Basically, I wish to fetch a filtered set of objects from the database (Oracle 9.2) based on the id property of the object PsalertsEvent. The code being executed is:
Public Overloads Function GetAll(ByVal laterThan As Long, ByVal filteredPsalertsEvents As IList) As IList Implements IPsalertsEventRepo.GetAll
'Get all psalerts events with an ID greater then the specified laterThan parameter
filteredPsalertsEvents = MyBase.NHibernateSession.CreateQuery("from PsalertsEvent p where p.id > " & laterThan).List
[Code]...
View 2 Replies
Feb 4, 2010
I just read this article about the Entity Framework 4 (actually version 2).Entity Framework seems to offer a huge improvement over its first release. Thus, I have never ever used EF in any project, since I think EF is not mature enough in comparison to NHibernate.NHibernate and its current contributions of FluentNHibernate and Linq for NHibernate by Ayende RahienMy feeling is that Microsoft is solely trying to gain terrain it has lost in favor of NHibernate when the 2nd version of NHibernate came out.Nevertheless, my concerns are the followings (not in particular order):Will EF4 tend to be less XML-verbose?Will EF4 be compatible with other underlying datastore than just SQL Server?What are the greatest benefits of going with EF4 instead of FluentNHibernate or NHibernate itself.
NHibernate is a great tool, I guess everyone agrees. Due to its predecessor Hibernate, we may easily find documentions and tutorials and sample applications to get acquainted with it. This is not the case for FluentNHibernate. Particularly as per the project I'm working on right now which demands that I investigate further about NHibernate and its options (FluentNHibernate for instance) in order to document the rules of usage and the best practices of NHibernat and FluentNHibernate technology. Thus, being handcuffed with VB.NET, being a C-Style developer, I can't find some syntax equivalencies in VB.NET for the examples provided, though I made I way so far
View 3 Replies
Oct 26, 2010
I would like to ask if you can use VB.NET for NHibernate and Fluent Nhibernate?I have searched the web, but I can't seem to get a detailed or explicit statement that tells that one can use VB.NET for NHibernate and with Fluent.
Many of the samples in the NHibernate site are made in C#. That's why I was wondering if I can't use VB.NET when using NHibernate.
View 2 Replies
Jun 22, 2011
I am working on a VB.Net application that needs to access a web service that I am nearly certain has a C# backend. At bare minimum, the backend is providing classes to me that are differentiated only by case, and within a number of those classes, there are properties and methods that are only differentiated by case.
VB.Net is case insensitive, and it sees a number of these items as being ambiguous.I've thought of a few ways of dealing with this, but I would like suggestions before I go down a road that is likely difficult.
Here are some ways I have considered going about it.Modifying the generated code for the wsdl. This has presented problems in responding as the xml output would no longer conform to the webservice requirements.I think there might be some attributes I could use to override this, but I'm not sure what they are yet. Even so, this web service gets frequent updates and I would hate to have to keep refixing the service every time I refreshed it.Creating a csharp wrapper project where I expose the underlying classes with different names. Primarily through inheritance. Although the big problem here has been the issue with properties and methods that are only differentiated by case as well.
I'm sure at some point I could get one or the other of these solutions working, but if anyone has any better suggestions that I'm not thinking of,
View 1 Replies
Sep 22, 2010
I have a function that works perfectly when I attempt to add a user from the same domain into a group of the same domain.
Function AddUserToGroup(ByVal strUserDN As String, ByVal strGroupDN As String, ByVal strGRPDC As String, ByVal strUserDC As String) As Boolean
Dim oUser As DirectoryEntry
[Code]....
The error is actually being thrown on the Invoke line, but as I said earlier, if the user is in the same domain, this works perfectly.
View 1 Replies
Jun 7, 2011
I have created a read-only property(name) in class1. How can I use this name property in class2?
Public Class Class1
ReadOnly Property name() As String
Get[code].....
Can I directly carry this name variable value into class2?
View 3 Replies
Oct 20, 2011
Is it possible to handle a property as an object?I want to reach a property as an object , not through its owner.
Dim prop as object = UNKNOWN_FUNC(btnTest.Text)
prop = "New text of btnText.Text" '
I want to modify Text property of btnTest by this way..
View 1 Replies
Mar 22, 2010
So far I only see Property being used as a means of validation in my learning material. I think maybe that's because it might be an easy way to demonstrate its usage. But isn't validation done with some kind of vb validation or on change event? Or do we use property in those events? I want to duplicate those techniques where applicable so I can get better and be more on the same page as the more advanced programmers. I'm working on incorporating classes to my work style. I see that I'm doing lots of repetitive type coding in projects that I want to put in a class. So Property keeps popping up during the learning curve. But I don't want to code Property in a mis-used way just for the sake of using it.
View 3 Replies
May 24, 2011
When i am assigning text in to textbox that time the selection start property is zero so the cursor(caret) is moving to first location of the textbox.
Code Sample
Consider that the textbox already have text like 'Hello Developers'
Dim CurPosition As Integer = TextBox1.SelectionStart
'CurPosition=11 (i.e) SelectionStart is 11 (cursor position)'
[Code]....
so when i am executing this code the cursor move up and down
View 1 Replies
Mar 26, 2008
In my never ending search for more knowledge, I have come across Partial Classes. I was wondering if some of the kind people who actually understand the uses could explain some of them to me. Now I know that when we create a form that we actually create a partial class which the generator rewrites when we add a control or change a property at design-time, and this allows us not to have to worry about setting up the controls ourselves.
[Code]...
View 2 Replies
Jul 3, 2009
I need to Poll remote machines and list the drives they have mapped along with the path(UNC) of that mapping.So far I got some code that will allow me to Poll my machine not the remote one and instead of giving me the UNC it gave me the share name which code work but is not Ideal.
-----------------code----------------------------
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
[code]....
View 4 Replies
May 20, 2010
I used sqlbulkcopy to upload huge data from local to remote. It works great.The only problem is that there is a table tClaim in which there are 50 columns. One clumn "IsUpload" do not need to upload. How to upload all columns except for this column? If I use columnmappings, do I have to code add column one by one?
View 1 Replies
Oct 19, 2009
I have a custom control with a bindable property:-
Private _Value As Object
<Bindable(True), ... > _
Public Property Value() As Object
Get
[code]....
Also, here, I'm adding a handler to the DataBindings.CollectionChanged event.This is the second place that I retrieve the type:-
Private Sub DataBindings_CollectionChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs)
If e.Action = CollectionChangeAction.Add Then
Dim b As Binding = DirectCast(e.Element, Binding)
[code]....
I need the first place, because the BindingContextChanged event is not fired until some time after InitializeComponent.The second place is needed if the binding field is programatically changed.Am I handling the correct events here, or is there a cleaner way to do it?
Note: My GetValueType method uses the CurrencyManager.GetItemProperties....etc, to retrieve the type.
View 1 Replies
Jun 7, 2012
I know how to handle a single objects property changed event very easily. I want to handle a objects property changed event that is part of another object.
Given Object:
[ObjectY = Y]
+ Public WithEvents X As ObjectX
I would like to do something like:
Private Sub XPropertyChanged() Handles Y.X.PropertyChanged
Right now I need to create a object that equals the object inside that object and then handle this variable pointers property changed, but that is just annoying.
View 1 Replies
Nov 23, 2009
i want to delete some files but only if they aren't in use. What i did was a try/catch:
Try
My.Computer.FileSystem.DeleteFile(fileInfo.FullName)
Catch ex As Exception
End Try
but it seems that this method is very slow if i try to delete some files over network.
Is there an faster way to delete files? Is it faster to check first if an file is open? If yes, how can i check if an file is open?
View 5 Replies
Apr 9, 2010
I have about 10 settings in my app which are set during coding, but the user can change them during the running of the app. They should then be saved so the same settings are there the next time the program is run.
View 1 Replies
Jan 23, 2012
I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.
View 2 Replies
Jun 13, 2012
How can I structure my classes so that the user interfaces though a single class while the supporting classes are hidden from their view? I think its best understood in an example:
Public Class MyInterface
Public Economic as EconomicClass
Public Sub New()
MyBase.New()
[code].....
So you might ask why am I even separating them? It's strictly for others who will be working with this interface. I need to funnel them though a logical structure:
interface.Economic.MyMethod
interface.Currency.MyMethod
etc
This way everything is already handled for them in the background and they only need to run the method they need. I don't know if I can have it both ways in VB.NET.
View 23 Replies
Jun 5, 2011
I've just about scrambled my brain on this, searching and trying things, so I'm hoping someone sees something that I'm missing or can explain it to me. I'm new to .NET, used to do a lot of programming in VB but that was many years ago.
[Code]...
View 1 Replies
Dec 22, 2009
How many times have we seen this type of selector:
I was just about to start creating this in a WinForms app, when I thought that others may have some ideas for doing this better. We need it to sort - so the right hand list will need up/down buttons. But this seems so old school. I love devexpress components, and was thinking of asking them if they would consider adding a component that handles this functionality with a slick UI.
I am thinking that a graphical representation of the objects, and a graphical representation of the listboxes - that would be a more intuitive way to move items around. Has anyone seen an open source project like this?
View 4 Replies
Oct 24, 2009
Here is some example code of what I mean:
vb
Public Class Form1
Private Sub Button1_Click(ByVal sender as Object, e as systemEventArgs) Handles Button1.Click
[Code]....
View 5 Replies
Jun 5, 2011
I don't know how to get my asp code to work on windows 7. I ran my project, it works correctly.
But for some pages I'm getting an HTTP 401.5 error.
View 1 Replies
Feb 5, 2012
Given that a typical coding mantra is "Don't induce side effects in method calls." and that the only reason (that I know off - please enlighten me if I'm wrong) to not use short circuited operators is when you depend on the side effects of a method call in subsequent code. Why isn't the default operator in languages like C# and VB.NET not a short circuited version?
[Code]...
View 1 Replies