After I published the packaged to IIS7, the exception occurred below.
Connection is already part of a local or a distributed transaction
referring to the article the problem is resolved.
https://forums.oracle.com/forums/thread.jspa?threadID=2263095
or http://forums.devart.com/viewtopic.php?t=20844
1. Switch to the File View of your LightSwitch Solution.
2. Select the "Server" Project and add a reference to "System.Transactions".
3. Open the Code for your Data Source (Right-Click on your Data Source --> Show/View Code)
4. Declare a using for System.Transactions:
using System.Transactions;
5. Enter following code snippet:
private TransactionScope _tscope;
partial void SaveChanges_Executing()
{
_tscope = new TransactionScope(TransactionScopeOption.Required,
new TransactionOptions
{
IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
});
}
partial void SaveChanges_Executed()
{
_tscope.Complete();
_tscope.Dispose();
}
if user forms authentication is checked, we need to input MS SQL connection when we deploy a package.
=>not possible to deploy with Oracle DB server
so check : Do not enable authentication, then we can deploy a package without MS SQL connection information.
Create a package on disk, select the directory the package should be created.
click publish ! We can see the package in the directory.
move the files including the package to a directory in Server computer.
1. ODAC for Oracle should be installed in server environment.
2. should install deploy 3.0 through web platform installer 4.5
deploy 3.0 download link : http://www.iis.net/downloads/microsoft/web-deploy
3. Deploy the package with deploy : load the application
4. Now we can see the website working well.
When I don't use bind variance , the response time is acceptable.
query.Where(e => e.CUST_LOT == "AAA");
But with a bind variance , obviously it spends too much time, which occurred time out error.
string Lotid = "AAA" ;
query.Where(e => e.CUST_LOT == Lotid );
I look into the query with Query tool, the plan is OK.
But When I check the session, there is a direct path read problem(Full path read).
I found a solution in the article below. use EntityFunctions.AsNonUnicode!
string Lotid = "AAA" ;
query.Where(e => e.CUST_LOT == EntityFunctions.AsNonUnicode(Lotid));
https://forums.oracle.com/forums/thread.jspa?messageID=10723648
[ the cause of this problem]
Because .NET string is Unicode, by default NVARCHAR2 is used in parameter binding for a string variable.
In WHERE clause, when one side is N type and the other side is not N type, data conversion occurs.
That may cause full table scan instead of using index.
EntityFunctions.AsNonUnicode() tells ODP.NET to treat a string as non Unicode. In this case, VARCHAR2
is used for the parameter binding. Because both sides are not N type, no more data conversion and
no more full table scan.
Light Switch에서 실행한 쿼리문을 Profiling 해주는 툴 , 굉장하다.
Trace 탭이 안보이는데 라이센스를 구매해야 하나. ㅠ.ㅠ.
When you start the profiler, you will get the following screen:
After I configured my test application and ran it, I got the following screen with all the information I needed:
You can see the queries that I run at the bottom, application statistic at the left menu and more important stuff which gives you very crucial details about your running application. You can also get an analysis of your code in the left menu such as:
One feature that I really liked and made me feel like a DBA was the ability to see the query plan of the query in a visual way:
And of course, the ability to run your queries from the profiler:
출처
http://www.codeproject.com/Articles/101214/EFProf-Profiler-Tool-for-Entity-Framework
Odata 를 Linq를 작성해서 바로 데이타를 볼수 있는 툴 좋다. ^^
In this article we will cover the simplest scenarios for connecting to LightSwitch using OData. We will not cover, inserting, updating, deleting, or validation.
We start with a simple LightSwitch application that contains a few Entities (tables) and Screens.
We Publish the application.
We enter some sample data.
We change the URL that we use to get to the application …
… to a URL with ApplicationData.svc.
This will allow us to see the OData Feed.
We can download and install LinqPad from: http://www.linqpad.net/.
We add a connection.
We select OData.
We enter the URL and click OK.
The Entities will show.
We can use the following query (in C# Statement(s) mode):
var DozenRedRoses =from Product in Products
where Product.ProductName == "Dozen Red Roses"
select Product;DozenRedRoses.Dump("The Dozen Red Roses");
// Set Product ID
var intProductID = DozenRedRoses.FirstOrDefault().Id;var OrderDetailsForRoses =from OrderDetail in OrderDetails
where OrderDetail.Product.Id == intProductIDwhere OrderDetail.Quantity > 1select OrderDetail;OrderDetailsForRoses.Dump("The order details for more than 2 roses");
// Get Order Detail IDs
List<int> OrderDetailIDs = new List<int>();foreach (var element in OrderDetailsForRoses){OrderDetailIDs.Add(element.OrderDetail_Order);}foreach (var element in OrderDetailIDs){var OrderForRoses =from Order in Orders
where Order.Id == elementselect Order;OrderForRoses.Dump("A order for more than 2 Red Roses");
}
To produce this result:
We can enable Forms Authentication and deploy the application again.
When we try to navigate to the OData methods it prompts us for a valid account.
참조 :
In most cases, it’s preferable for queries to be executed remotely. However, it sometimes isn't
possible to execute a query remotely, because the data service might not support a specific query
operation.
<Query Pipeline>