Return Object As Parameter For NHibernate Entity?

Nov 2, 2010

I'm writing a solution where the data entities are passed to clients using datasets through a WCF service, with nHibernate as ORM. My predecessor has written some translator classes, converting datasets to entities and vice versa. In most cases he's declared the return object as a parameter for the object.

For example:

Public Shared Function CreateEntity(ByVal ds As DataSetObject, ByVal entity As EntityObject) As EntityObject
Dim row As ds.EntityObjectRow = ds.EntityObject(0)
entity.Id = row.Id

[code]....

He's not with the company anymore, so I can't ask him why he's done it this way. Hence my question here. Is there some performance gain, or traceablity thing with nHibernate by using the first implementation rather than the latter?

View 1 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

Asp.net - Entity Framework - Passing Different Object Sets As A Parameter In A Function?

Apr 11, 2012

I have the following code:

Private Sub setDropdowns()
Using licensingModel As New licensingEntities

[code]....

My problem is that i dont know how to define the parameter type for the sub. Because they are different types of objectSets being passed each time, I thought IObjectSet(Of EntityObject) would work, but it gives me the following error:

Unable to cast object of type 'System.Data.Objects.ObjectSet1[licensingModel.tblLookup_Country]' to
type
'System.Data.Objects.IObjectSet1[System.Data.Objects.DataClasses.EntityObject]'‌

View 1 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

.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

Asp.net Mvc - Dynamic Object Properties In A MVC Helper On Entity Framework Object

Jul 20, 2009

I want to build a MVC helper function for which I pass a Entity Framework object and have it build a select. Generally speaking I tried something like this:

Public Function RenderSelect(ByVal helper As HtmlHelper, ByVal sSelectName As String, ByVal aItmes As Array, Optional ByVal sTitleKeyName As String = "name", Optional ByVal sValueKeyName As String = "id") As String
' open select

[Code].....

However, it isn't working. It would be great to have a way to do this and pass the current entity object.

View 3 Replies

Dynamic Object Properties In A MVC Helper On A Entity Framework Object?

Oct 26, 2010

Dynamic Object Properties in a MVC Helper on a Entity Framework object

View 1 Replies

Asp.net - Set A Server Side Parameter On An A Entity Data Source?

Oct 6, 2010

I have a gridview which I databind to EntityModel This typically looks like

something a
something b
companyID

on Login I get and set the compnay which has the ID so what in essence I want to do is on databind set the Where clause of data source to what the server side paramter for company ID is. I am sure this is super simple but it is driving me nuts

View 1 Replies

Return Column Names Of A LINQ Entity?

Feb 2, 2011

I am using LINQ to SQL queries to return data in my application. However I find it is now needful for me to return the column Names. Try as I might I have been completely unable to find out how to do this on the internet.

So if my LINQ entity table has the properties (Last_Name, First_name, Middle_Name) I need to return[code]...

View 2 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

Return An Object As The Return Value Through A RealProxy Transparent Proxy?

Oct 7, 2010

I'm working up a system where I plan on using RealProxy objects to enable intercepting method calls against a set of objects, handling the call, and then returning appropriate results. This works just find for simple return types like strings or ints, but I can't seem to return objects from the RealProxy.Invoke method. Everything works. I get no errors, but the returned value is always NOTHING, instead of an object.

I've worked up the smallest sample code I could, and have included it below. Essentially, just call RPtest and single step through. The code creates a simple object, RPTestA, with a string field and an object valued field It then retrieves the string

[Code]...

View 1 Replies

Creating A Custom Entity Class(object)?

May 13, 2011

How would I create my custom Role class based on that autogenerated class? I have read a few articles on the net but I am still lost. Can someone please show me how to do this, and what I must import(using visual basic). I want to add some validation to the string property where Role1 cannot be more than 50 characters.
Autogenerated class

[Code]...

View 2 Replies

Indicate That An Entity Framework Object Is Implementing An Interface?

Feb 1, 2011

I have to begin saying that I'm working with Visual Basic. The problem is that I have a Entity Framework object and I want to indicate that this object implements a interface, for example:

Public Interface ICatalog
Property created_at() As Date
Property id() As Long
End Interface

Those properties are allready in the object. In c# I've done this just by declaring a partial class of the object and indicates that implements that interface, but in basic is not working, I supouse that is because of the language sintaxis used to declare that a property is implementing some property of the interface, for example:Public Property created_at() As Date Implements ICatalog.created_at

View 2 Replies

Order By On A Modified Entity Framework Object?

Jan 25, 2010

I'm getting an Entity Framework object collection from my Products table called oProducts. I am looping through the collection and setting the Quantity field from a separate function. Before I write out a display of the objects in HTML, I want to sort them by the Quantity. So, I am using LINQ to create a new collection and try to order from the object collection that I just modified. The modified values are definitely in the object collection and output properly, but the sort ordering isn't working on the modified field.

Dim oProducts = From p in ctx.Products _
Where p.Active = True _
Select p

[Code]....

View 3 Replies

Return Type Of Parameter Is Not CLS-compliant

Jun 28, 2010

I have a base class with a static function that returns a typed dataset. I have several classes that inherit the base class with a non-static function that returns the same typed dataset. On these methods I get the 'Return type of parameter yadda
is not CLS-compliant' I don't understand where this is coming from. I have non unsigned integers/etc. in this dataset.

View 2 Replies

Entity Framework Navigable Property Not Set To Instance Of Object?

Mar 21, 2012

I have the following query:

Dim queryStudent = (From p In dbContext.Residents _
Where p.people_code_id = people_id _
Where p.year = year _

[code].....

View 2 Replies

.net - Will Sqldatareader With Using Statement Ever Return An Output Parameter

Aug 21, 2011

Here's a simple code snippet of a larger function as an example.

Using conn as New SqlConnection("conn string")
Using find as new SqlCommand("ExampleProc",conn)
Dim rParam as new SqlParameter("@RESULT",SqlDbType.Int)

[code]....

I know the Output parameter is returned after the SqlDataReader is closed. From what I think I know, the Using statement will call .Dispose on the SqlDataReader, so will that basically wipe out the Output parameter? If so, what is the best method to call a SqlDataReader that also contains Output parameters that closes and disposes everything correctly? Let me add that based on what I've read you only have access to the Output parameter using a SqlDataReader after you call .Close on the SqlDataReader.

View 2 Replies

How To Handle Variable Type (parameter & Return Value)

May 25, 2011

Is it possible to replace these two functions

Function f1 (s As String) As class1()
Dim a() As String = Split(s)
Dim b(UBound(a)) As class1

[code].....

View 3 Replies

VS 2008 Way Of Declaring A Parameter In Function And Return A Value?

Apr 26, 2010

I have created my own ListViewItem class, and added some custom properties to it of attributes. What I have at the moment is a tooltip which shows all of those custom properties (about 18 of them).What I want to be able to do is if multiple are selected, to show a tooltip, but if a property (say Title) for all of them is "My Title" it will show that, otherwise if they are different, I would like it to show "VARIES"Is there a way of declaring a parameter in my function and return a value? [code]

View 1 Replies

Return An Array Of Object Interface's Rather Than An Object?

Mar 4, 2009

I have an interface that describes an specialized list in my application...

[Code]....

Is there a way to make an interface serializable, or am I going to have to convert each of my objects into a concrete class implementing the interface, and then return that class?

View 2 Replies

Reporting Services - Input Parameter Needs To Return All Records If Left Blank

Jul 9, 2009

I have an input parameter for my stored Proc, Instead of choosing available values from a drop Dwn, the customer wants an empty input box that when left blank returns all records. the parameter type is numeric(6,0) in the Db. I have not found a way to leave the input blank and retrieve all records. my default value for all records is '-99' and also is declared as the default value for the param in the proc.

View 1 Replies

Asp.net - Linq Group By An Entity And Then Order By The Grouped (nullable) Entity

Jul 27, 2011

I am trying to build a survey engine from an existing database design which is like this.

[Code]...

The line Order By Key.RecordOrder throws a null reference exception and I can understand why. Can someone advise on how to resolve this by just modifying this one query? I am fairly new to LINQ and the necessity to write this project

[Code]...

View 1 Replies

.net - ADO.net Entity Framework - Update Only Certain Properties On A Detached Entity

Jul 22, 2009

I want to update an entity without loading the entity from the database first. I've accomplished this but only by knowing all of the entities properties and then using the "attachto" method. My issues is i don't want my app to need to remember all of the properties. Example:

[Code]....

View 3 Replies

.NET Sample Entity Framework 4.2 Code First Entity Splitting?

Dec 14, 2011

Entity Splitting: one class, two or more tables.Here is how it is done in C#, but I need to get it working in vb.net.One more thing: the class name and table columns do not match, so I have to be able to map that out, too.I have to get this to work this way because the place I'm working at right now is a vb.net only shop and the database schema is fubar, but they have so much (millions) of lines of code done directly against the database in both asp classic, vb.net, AND asp.net webforms that changing the schema right now is not realistically possible.

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Post>()
.Map(m =>

[code]....

View 1 Replies

List Of T Find Date Or Other Property In A Object In The List - Then Return Found Object?

Sep 3, 2009

After reading all the examples for list of T exists and Find and find first, none show how to handle multi-property objects. Below is bare bones example maybe someone could flesh out to show how this should be done.

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DatePriceList As New List(Of DateAndPrice)
DatePriceList.Add(New DateAndPrice(Date.Parse("1/1/2000"), 10.12))
DatePriceList.Add(New DateAndPrice(Date.Parse("1/2/2000"), 11.12))

[Code]...

View 3 Replies

Asp.net - Using ExecuteQuery() With Entity Framework, Entity Class

Jan 16, 2011

I am trying to jump from ASP Classic to asp.net. I have followed tutorials to get Entity Framework and LINQ to connect to my test database, but I am having difficulties figuring out ExecuteQuery(). I believe the problem is that I need an "entity class" for my database, but I can't figure out how to do it. Here is my simple code:

Dim db as New TestModel.TestEntity
Dim results AS IEnumerable(OF ???) = db.ExecuteQuery(Of ???)("Select * from Table1")

From the microsoft example site, they use an entity class called Customers, but I don't understand what that means.

View 1 Replies

C# - Inherited Entity Item Not Recognized As Entity?

Feb 11, 2011

I am trying to create a generic typed class, but am running into a problem. Here is my basic class definition:

public class QueueObject<T> where T : System.ServiceModel.DomainServices.Client.Entity
{
public string LoadingMessage { get; set; }
public System.ServiceModel.DomainServices.Client.EntityQuery<T> Query { get; set; }
}

I am trying to add instances of this class to a queue

private Queue<QueueObject<Entity>> _queue;
this._queue.Enqueue(new QueueObject<MyEntity> {Query = MyContext.GetMyEntitiesQuery(), LoadingMessage = "Loading some stuff"});

This doesn't work. I get an error saying that QueueObject cannont be converted to QueueObject. I don't understand because MyEntity inherits from Entity.

Public Class QueueObject(Of T As System.ServiceModel.DomainServices.Client.Entity)
Public Property LoadingMessage As String
Public Property Query As System.ServiceModel.DomainServices.Client.EntityQuery(Of T)
End Class

[code]....

View 2 Replies

Get Parameter From HTML OBJECT

Dec 10, 2011

I start making app for one Facebook game (to make easier playing that game) Key thing is that I need to get few parameters from HTML source when game is loaded in WebBrowser control. But, problem is that parameters doesn't really exist in HTML source. They are generated in game loading and when I you Firefox or Chrome and click "View Source" I can't see them. When I use FireBug on FF or Chrome developer tools I see them like this on picture:

View 2 Replies

Object Must Pass Itself As A Parameter?

Sep 10, 2011

I have various shape objects, and I want each unique shape to implement a saveToDB method that simply calls a DB object that implements a Save method with an object as its input paramter. This DB.Save method will be a long case function that implements the proper SQL commands based on the type of attributes possessed by the input parameter object.how do I implement the SaveToDB method in my Shape class? Is it something like this:

Function Shape.SaveToDB
DB.Save(Me)
End Function

The goal here is to let each shape save itself without it knowing anything about database operations; I want to isolate db-specific information in my intermediary DB object, so the DB object will have to figure out what type of object wants to be saved into the SQL database and then execute whatever SQL instructions are needed. And then if I override the SaveToDB method in each shape subclass, I can avoid the case statement entirely, replacing it with a series of unique methods such as db.SaveCircle (ob), db.SaveSquare (ob), etc., sincle the caller already knows what it is.

View 4 Replies

Method/sub That Takes An Object As A Parameter?

Dec 23, 2010

I have a method/sub that takes an object as a parameter, then it scans through a panels controls and trys to find if it is in the window.

Public Sub removetype (ByVal findobject As Object)
Dim types As System.Type = findobject.GetType
For Each ThisCtrl In Flow.Controls 'flow is a panel

[Code]......

View 3 Replies







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