DataSource Controls :: How To Use Nhibernate - Framework
Mar 15, 2010How to use Nhibernate give step by step description and what are required tools needed for implemented including dotnet framework
View 1 RepliesHow to use Nhibernate give step by step description and what are required tools needed for implemented including dotnet framework
View 1 RepliesCould any one explain me which ORM is best?
View 3 RepliesI am tasked to build a web 2.0 style mashup application which consumes a lot of 3rd party webservices like youtube and twitter. There are also lots custom features which are going to be built using ASP.NET 3.5 and SQL Server 2008. Now I am looking for the right ORM for my needs. From a performance and ease of use standpoint can anyone suggest me the right ORM for this kind of web application?
View 1 Repliesgive me an example of foreign key mapping & class description cause I don't get it.
View 4 Repliesi am trying to use nhibernate second level cache, i have configured my cfg as
<property
name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider,NHibernate.Caches.SysCache</property>
<property
name="cache.use_query_cache">true</property>
<property
name="cache.use_second_level_cache">true</property>
<property
name="cache.default_expiration">120</property>
and also enable cache in presistent class as <cache
usage="read-write"/>
now what steps i have to take to check whether the cahce is working or not, do i have to write some C# code for cache?
Which version of Visual Studio 2008 do you currently use with NHibernate? I would like to test out NHibernate at home, but I'm not sure if I want to shell out $500 plus for VS 2008 professional edition. Has anyone had any luck with NHibernate on VS 2008 standard or even one of the VS express editions?
View 4 RepliesI set up Entity Framework for my Table and Stored Procedure to return data. Created a Domain Class as well.
In Domain Class, I am returning Objects as collection.
On .Aspnet page when I drop a Control(Combo,Dropdown) I can set up the source for the controls visually if the source is table.
However, In domain class I have stored precedure object that return collection of data And I cant not set up visually from Designer, I am only available to write code behind. is it possibble that i can set up from desingner.
CAN we use Entity framework in web services.I the following error while the code connects to the database using entity framework
View 3 RepliesI have a sql server database that includes the field ArticleID of type uniqueidentifier that is a primary key and is set to be auto-generated by the database when a new article is added.If i generate my entity model and do the following code:
[Code]....
Then a new article is saved to the database but the entity framework must be generating a new blank Guid and saving that to the database rather than allowing it to be auto generated as the articleid that shows up saved is all 0.How can i get the Entity Framework to let the Database generate the ArticleId?
i joined together more than one entity: Customer, Personel etc. i used inner join structures. if i look adonet entity framework ,5 entities are generated. i need to run this SP in C# side:
[Code]....
LOOK BELOW PİC : you can understand it :
MY C# codes: [Code]....
How can i get all joined data from sql with using randevu.GetRandevular(customerID
I have 3 tables User, role and UserInRole THe entity frame work made entities for User and Role and I have successfully made a join with the user and role entities using user.add(role); but I can't seem to get it to remove the link (I want to retain the user and role just remove their association).
using (ProviderEntities context = new ProviderEntities())
{
User u = context.User
.Where(n => n.ApplicationName == application)
.Where(n => n.Username == username).First();
Roles r = context.Roles
.Where(n => n.ApplicationName == application)
.Where(n => n.RoleName == roleName)
.First();
r.User.Remove(u);
context.SaveChanges();
}
The oposite worked when I did r.User.Add(u); but it wont let me now remove it after it been created. Driving me mad as I can't see where I have gone wrong.
I transfered my data from MDF files to MS SQL Database, but I can't get it working with entity framework.
My Old connection string is:
metadata=res://*/Models.EntityModel.csdl|res://*/Models.EntityModel.ssdl|res://*/Models.EntityModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|TripsDB.mdf;Integrated Security=True;User
Instance=True;MultipleActiveResultSets=True"
I put all data from TripsDB.mdf to Trips table in local MS SQL 2008 Enterprise database. Also changed connection string to:
Server=WIESIEK;Database=Trips;Trusted_Connection=True;providerName=System.Data.SqlClient;User ID=Jan J. Roman
But my application throws System.ArgumentExceptio with message: The 'server' keyword is not supported.
on line:
private TripsDBEntities2 _entity = new TripsDBEntities2();where TripsDBEntities2 is Entity Framework instance.
I have a stored procedure that generates a float value. I've added the stored procedure to my edmx file and created a function import, but the function isn't showing up in the object browser or via intellisense.
I'm using Visual Studio 2010 and I've verified that the stored procedure works in SSMS. Here is the current stored proc I'm using:
[Code]....
CarType
Id - PK
Name
CarDetail
Id - PK
TypeId - FK to CarType
I have this simple example here and I want to insert a new CarDetail into the database but for some reason I cannot get the EntityKey to work in EF4 and Framework4 beta 2.
If i declare the following
car_detail.CarTypeReference.EntityKey = new System.Data.EntityKey("MyDB.CarType", "Id", 1)
Each time i try to call SaveChanges, it throws a INSERT constraint error saying that there is a conflict between CarType and CarDetail with the FK. It just seems like the hard coded 1 for CarType is NOT being passed through but instead the default value of 0. What is going on?
If i call car_detail.TypeId = 1 then it works fine with the INSERT.
Why doesn't the EntityKey method work?
ASP.NET 4.0 comes up with a bulk of noticable improvements , including freshment of LINQ to Entities model. Other than this , I still remember another .net built-in ORM framework "LinqToSQL" which provides a lighter and more direct way to interact with SQL-server based db system. However, it seems no term concerns "Linq to sql" in .net 4.0 pulication announcement. So I think it might be deprecated in the furture due to .Net team's plan. I wonder if .NET team decide to just choose entity framework to fully serve as the .NET official ORM implement and no longer develop 'LinqToSQL' . Is LinqToSQL really an attemptive speck and not worth holding in the furture?
View 1 Replieshow to do this query in EF1:
[Code]....
I have created a .edmx for the northwind database. When I run the following statement, the correct number of detail records are retrieved and I can access the detail fields, but how do I access the order header record to view OrderDate, ShipAddress, etc...?
[Code]....
public void saveOptionalCourses( ArrayList coursesAdded, int studentID)
{
StudentOptionalCoursesXRef XRefObject = new StudentOptionalCoursesXRef();
using (var EntityObject = new SchoolProjectEntities2())
{
foreach ( string list in coursesAdded)
{
XRefObject.StudentDetails = EntityObject.StudentDetails.Where(c => c.StudentID == studentID).First();
XRefObject.OptionalCourses = EntityObject.OptionalCourses.Where(c => c.OptionalCourseName == list).FirstOrDefault();
EntityObject.AddToStudentOptionalCoursesXRef(XRefObject);
}
EntityObject.SaveChanges();
}
with this above method and could save only last row that am returning remaining rows are iterated but are not saving on to database
I'm using the linq to entity command to perform a record update. I want to set one of the fields back to NULL but I'm not sure how do it. I have a query such as
Dim record = From r in db.LISTS where r.ID = refID Select r
record.Title = txtTitle.text
if txtDetail.text = "" then
record.Detail =
end if
I am just getting started with entity framework with asp.net 3.5 using VS 2008
There are two tables, Categories & Subcategories:
Category table: CID, CategoryName Sub Category table: SID, CID, SubCategoryName I would like to get SID, CID, CategoryName, SubCategoryName in the gridview. Just as we write a select statement i.eSelect a.sid, b.cid, b.categoryname, b.subcategoryname from subcategories a inner join categories b on a.cid=b.cid & put the same in a gridview.
I was trying for the whole day & couldnt get atleast one url that would teach how to do it.
I can't to understand clearly how to create strong and quickly application using EF. For example, I have class ForumPost (table ForumPost) for select one of record I write method like:
public ForumPost ForumPost(int ForumPostID)
{
return
(from i in _dataContext.ForumPostSet
where i.ForumPostID == ForumPostID select i).First();
}
all works. But on page (I use ASP.NET MVC) I should display info from another linked tables, ForumName (each post have ForumID) etc. So, I modify this method to:
public ForumPost ForumPost(int ForumPostID)
{
return
(from i in _dataContext.ForumPostSet
.Include("ChildPosts").Include("ParentPost").Include("Users").Include("Forums").Include("Tags").Include("ForumPostPolls")
where i.ForumPostID == ForumPostID select i).First();
}
ok, all works. Then I want to make some actions in model with ForumPost, i.e.
public void RootPost(int PostID, ref Models.ForumPost Root)
{
ForumPost post = ForumPost(PostID);
if (post.RootPost != null)
{
Root = ForumPost(post.RootPost.ForumPostID);
}
else
Root = post;
}
it works too. But problem is in speed. I not need in RootPost all those includes. So, I should to create one more method like:
private ForumPost ForumPostIncludes1(int ForumPostID)
{
return
(from i in _dataContext.ForumPostSet
.Include("ChildPosts")
where i.ForumPostID == ForumPostID
select i).First();
}
then ForumPostIncludes2, ForumPostIncludes3 etc... second way - redesign RootPost with LINQ expr, not with call another method. But in this way difficulties to change DB. third way? How to do it correctly?
I am trying to get some guidance with this issue:
I have a Customer object that has two address ID fields (one for HomeAddress and one for WorkAddress)
I am loading the Address Objects by using Include="HomeAddress, WorkAddress" and then binding to the properties using the Navigation Property on the Customer Entity
Can I use just one FormView for doing the Insert/Updates and binding it to an EntityDataSource or would I have to do all the Inserting/Updating manually?
I've sucefully created a method to insert values through EF, but i've a question (maybe, a newbie question).
Should i send the values to be inserted as strings to the DAL, and then i create the object there or should i create the object in View Layer and then send him to DAL?
Example 1 (DAL):
[Code]....
Example 1 (View Layer, on a click button for example):
[Code]....
Or should i receive the strings in DAL like this: public bool NoticiasInsert(string tituloPT, string tituloEN, string descricaoPT, string descricaoEN)
Then i create the object cdcModel.noticias and set the fields there with the strings values.
What do you advice me to do? I know that both ways works, but i'm trying to develope with better patterns (i don't know if this is the exacly word, sorry my bad english)
cdcModel.noticias campos = new cdcModel.noticias();
campos.tituloPT = "a";
campos.tituloEN = "b";
campos.descricaoPT = "a";
campos.descricaoEN = "a";
if (DAL.NoticiasInsert(campos)
I have developed a Portal (Request submission) which sends an Email and also it updates all values to the Database. What ever values gets updated to the database, will be sent as an email message to an address. It works fine. I need a Unique number to be generated for a Request submission which has to be sent in the Email message and also it has to be updated in the database. I use SQL Server 2005 and Framework 2, C# laungauge.
View 10 RepliesI have three table like above, table C is mapping table which has foreign key of Table A and B.How can i select and insert data in Table C using Entity Frame Work?
View 2 Replies