Nhibernate - What Would Be The Equivalent .NET Code For This C# FluentNHibernate Component Mapping

Feb 4, 2010

I'm a C# programmer constrained to write VB.NET code.While exploring NHibernate further for my current client, I encountered FluentNHibernate, which I find real attractive.But now, I wonder how to "translate" this C# code for component mapping into VB.NET code:

Component(x => x.Address, m =>
{
m.Map(x => x.Number);
m.Map(x => x.Street);

[code]....

what I miss is how to continue with the brackets in VB.NET, since there's no Begin End keywords or so.

EDIT 1: Following Mr. JaredPar instructions, I figured that his solution might work. If we take the time to read his answer, we may notice that we both don't know what the MType is within his solution. I might have found out that the MType is:

FluentNHibernate.Mapping.ComponentPart(Of TComponent)

Thus, TComponent is, from my understanding, an anonymous type that I shall parameter to use. From this point of view, since I wish to map the properties of my Address object, replacing TComponent in my help method signature seems not to work.

Private Sub MapAdresseHelper(Of Adresse)(ByVal a As FluentNHibernate.Mapping.ComponentPart(Of Adresse))
a.Map(Function(m) m.Number)
a.Map(Function(m) m.Street).Length(50)

[code]...

The error I get is that my Address class doesn't have a property member named Street, for instance. It sees my Address type, it recognizes it, but it seems buggy somehow. I guess VBNET is poorly designed for lambda expressions and is less evolved than C#?

View 3 Replies


ADVERTISEMENT

MS Entity Framework VS NHibernate And Its Derived Contribs (FluentNHibernate, Linq For NHibernate)?

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

C# - Nhibernate Mapping Of System.Drawing.Image?

Oct 5, 2010

Question: I get an exception serializing this class to a nHibernate xml file ({"Could not determine type for: System.Drawing.Image, System.Drawing, for columns:NHibernate.Mapping.Column(Settings)"}).

using System;
using System.Collections.Generic;
using System.Text;

[code].....

View 3 Replies

Mapping Custom GUID With Fluent NHibernate

Dec 6, 2011

I am using Fluent NHibernate to map an Oracle database. It is a legacy database so I cant really change everything I want.There is a GUID field, but the keys are still composite (I will change this as soon as I can so that the keys are not composite, but I cant do it right now). The GUID is a VARCHAR2 field with this layout: 551608b1-275d-49f6-9561-44d01aacf23f. The GUID is not added by a sequence in Oracle, but inserted from code (C# or VB.net)[code]Is the problem that I dont use a sequence to generate my GUID? How can I overcome this?

View 1 Replies

NHibernate Mapping SQL-VIEW Without Unique Identifier?

Oct 13, 2011

I have a read-only mssql-view, and I want to map it to nhibernate (using hbm.xml files). The view is a select that joins two tables. For give an abstract-insight, the select is something like this:

SELECT A.Id As A_ID, B.Id As B_ID,
A.AttributeA, B.AttributeB,
FROM A INNER JOIN B ON
A.Id = B.RootID

It's a one-to-many relationship between A and B (B entries are dependant/leafs of A entries).

I'm using nhibernate's hbm.xml files, and I can't make it to work. I'd gladly appreciate if someone can enlight me of the kind of XML that I have to use, I guess that as my view has no ID, I have to create a composite-nhibernate id (wich will be the ids os A and B together) but I couldn't make it to work. Also the view is READ ONLY so I think that should make the solution easier.

View 2 Replies

Fluent NHibernate Not Mapping Child Rows To A Collection Property (DB2 Database)

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

Finding A BitBLT Equivalent As In XOR Or OR Mapping?

Oct 13, 2009

I use vb.net 2005.I want to take one image and place it on top of another image, I want to blend the images using various techniques such as OR or XOR od AND functions.I understand BitBlt does this.1) Is this the technique i should use in .net? Or is there some complicated parameters burried deep in the graphics.drawimage method?2) How do i declare the BitBlt function and what are the values of the ROP parameters?

View 9 Replies

.net - NHIbernate NHibernate Attempts To Execute A Database Update During CreateQuery Execution?

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

C# - NHibernate Entity Code Conversion From #C?

Jan 12, 2011

I am starting on the NHibernate world and i am experimenting with the NHibernate CookBook
recipes, i am trying to set a base entity class for my entities and this is the C# code for this. I would like to know whats the VB.NET version so i can implement it in my sample project

View 3 Replies

VS 2008 .NET For NHibernate And Fluent NHibernate?

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

FluentNhibernate And Table/column Name Capital Letter Preservation And Escaping?

Mar 17, 2012

Question regarding fluent nHibernate table mappings:Apparently I was under the mistaken impression, that with an ORM tool, such as nHibernate, one could gain database independence - at least in table creation.Now, I have an automated toowhich creates fluent nHibernate mappings for me.It also works fine (though only if ALL tables have a primary key...)

Here a good representative example for such a mapping as it is created by the program
public class ELMAH_ErrorMap : ClassMap<ELMAH_Error>
{

[code].....

View 1 Replies

.net Equivalent For The Code?

Jul 28, 2009

private bool txtRegExStringIsValid(string textToValidate)
{
Regex TheRegExpression;
string TheTextToValidate;

[code]....

View 2 Replies

Equivalent Of C# Code In VB?

Nov 24, 2010

The code in C# is as follows:private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)

[Code]...

View 3 Replies

Equivalent Of This VB6 Code In .net?

Jun 6, 2011

Schema is a string, lstSchemas is listbpb and rc is a variant

Schema = VB6.GetItemString(lstSchemas, rc)

View 1 Replies

Use Something Equivalent To The CODE In VB?

Jan 23, 2010

I find that when I have the string

in cell (1,1)

and in Excel I put in cell(2,1) the formula

= code(mid(A1,1,1))

I get the result 63, which I should.But in visual basic, when I write

v1 = .cells(1,1)
.cells(3,1) = v1
msgbox asc(mid(v1,1,1))

the message returns 65, which is the code for A, not Ā.It is clear that VB is reading the contents of cell(1,1) correctly because it puts the correct text in cell(3,1).The Code function isn't supported in Visual Basic. I have been unsuccessful trying to use Application.code It won't compile. How can I get VB to give the correct code of the character Ā?

View 1 Replies

What Is The Equivalent Code In .Net

Feb 22, 2011

What is the equivalent vb.net code of the following?

using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace ContosoUniversity.DAL

[code]....

View 3 Replies

Compile Error For Seemingly "equivalent" .NET Code (compared To C# Code

May 4, 2010

Following is the OnCallBack (async communications handler method) in C# and translated to VB.NET.The c# one works fine, but the VB.NET one gives a compilation error: "Property access must assign to the property or use its value." The error happens on the following line:

state.CallBack(Me,
New
ClientEventArgs()
With

[Code]...

View 10 Replies

What's The Equivalent Code Of This In VB Express 2010

Jun 13, 2011

got this code from this site: [URL] public static void Send(String from, String to, String subject, String messageText).

SmtpMail.Send("mcb@mindcracker.com", "webmaster@mindcracker.com", "Subject", "Message body").

what's the equivalent code of this in vb express 2010.

View 4 Replies

Get Auto-generate Code For Component

Jul 27, 2010

I build a component class it extends a combo box and generates some random numbers. But when I drag and drop my component from the toolbox to a form it auto generates Me.Randtest1.Items.AddRange(...) in the Designer which uses static numbers. The idea was to have different numbers each time and not the same.[code]

View 1 Replies

.NET Equivalent Of This C# Code For Wiring Up And Declaring An Event?

May 26, 2010

I'm working on a tutorial to build a media player in Silverlight and am trying to wire up an EventHandler to the timer.Tick event of a DispatchTimer object so that the time of the video is synced with a Slider object.

The sample code is in C# and I can't for the life of me figure out the proper syntax in VB.NET with RaiseEvent and/or Handles to wire up the event. Below is the relevant C# code. I'll include comments on where I'm getting stuck.

[Code]...

View 1 Replies

Equivalent Of Excel's CODE Function To Work

Jan 23, 2010

In cell A1 of Sheet2 I have the following text [code]how to I get VB to recognize that the 4<sup>th</sup> character of the string has character code 63?

View 3 Replies

OpenFileDialog Equivalent Code For Console Applications?

Apr 26, 2012

In the GUI world, OpenFileDialog provides one stop shopping for the user to select the drive, the folder and then the file.Has anyone seen a set of code to implement this functionality (although obviously one value at at time /select drive/selectfolder/select file) in a console application?

View 1 Replies

VS 2008 Creating A Component WithEvents In Code?

Jan 28, 2010

So I have a custom control that when added to a form will create two child controls inside it. The custom control's designer handles the creation of these. The problem I am having is that when the designer generates code for these controls only the parent control is declared "WithEvents". So my que

View 9 Replies

C# Equivalent Of The Code: DataTable.GetChanges(Not DataRowState.Deleted)?

Jan 23, 2011

In VB.NET:

DataTable.GetChanges(Not DataRowState.Deleted)

What is the equivalent in C#?

View 2 Replies

Equivalent Using Statement Code For Which Online Translators Don't Work?

Aug 26, 2010

How do I write the equivalent c# code below in vb.net? This 'About' form is launched by a ToolItemMenu. It is just informational and contains only an OK button

//Form contains company logo, copyright info and OK button.
public About formAbout;
using (formAbout = new About())

[code].....

View 1 Replies

.net - What Is Equivalent Code For Following C# Code

Dec 16, 2009

if (node.Attributes != null) //checking for attributes of a xml file node.

View 4 Replies

App.TaskVisible Equivalent Code - Which Hides The Application In The Applications List In Task Manager?

Dec 20, 2010

anyone knows the equivalent code for App.TaskVisible in VB.net? App.TaskVisible is from VB6 which hides the application in the applications list in task manager and not in the processes list tab.

View 1 Replies

Clean Elegant Solution To Form-class Level Component Collection Initializing Before Initialize Component?

Feb 3, 2011

I am converting an old Vb6 solution to .net 2.0 in vs2010. I've been working in C# for about 3 years now and .net for 5. I don't recall having this problem in C#, but if I want initialize a readonly collection of DerivedControlFoo Is there a clean way to do it besides creating a sub to do it all off somewhere else? I'd love to be able to do it at the class level at the declaration for readability and simplicity.

View 1 Replies

Create A DLL Component For Database Operation And Use Created Component In Another Project

Mar 1, 2010

Create a DLL component for database operation and use created component in another project. Required methods, events and properties

a. Connect
b. Add
c. Delete
d. Save
e. Record navigation (first, next, previous, last)
f. Properties for all database fields
g. Events for validation of database fields.

View 1 Replies

C# - Change A Component Name In A Component Designer In WinForms .Net

Jan 8, 2010

I've created a component whose name I'd like to be able to change while editing in the component tray. I've added a Designer action for a name property, but now I'm stuck.

Looking at the property grid, I can see that the name property is parenthesised, indicating that it's not a regular property.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved