Every tutorial or documentation regarding this subject is used with sql queries but never with new orm.
I have two data sources defined in config/app.php: default and not_default
with same tables and columns, when the user login the default database is connected.
when the user clicks a certain button i need to change the connected database to not_default:
I achieved this so far:
ConnectionManager::get('default')->disconnect();
ConnectionManager::get('not_default')->connect();
ConnectionManager::get('not_default')->begin(); //dont know if required
when doing this: echo ConnectionManager::get('not_default')->isConnected(); I get 1 for not_default and 0 for default so it is connected
but the problem is when getting the model's TableRegistry the connectionname is still the default one!! How to change it???
I want to be able to get data using orm from database other than the default one.
You can use ConnectionManager::alias().
Connection aliases allow you to rename active connections without overwriting the aliased connection.
ConnectionManager::alias('not_default','default');
//from now on, all calls to default will resolve to not_default datasource
Related
I have an Azure Data Factory Pipeline with a For Each Activity. This contains a Copy Data Activity which should insert into Azure Sql. I need to make use of the Additional columns feature but it refuses to let me select any value other than $$FILEPATH. It also will not let me type anything into the VALUE combo box.
Has anyone else hit this problem?
A workaround is to add a column as you did and change its value by editing the code of the pipeline.
The problem is a display issue with the scrolling menu hidden by a layer (I have it too). It is maybe specific to some web browsers.
This one is making me crasy : I have an EF model built upon a database that contains a table named Category with 6 rows in it.
I want to display this in a drop down list in WPF, so I need to bind it to the Categories.Local Observable collection.
The problem is that this observable collection never receives the content of the database table. My understanding is that the collection should get in sync with the database when performing a query or saving data with SaveChanges() So I ran the followin 2 tests :
Categories = _db.Categories.Local;
// test 1
Debug.WriteLine(_db.Categories.Count());
Debug.WriteLine(_db.Categories.Local.Count());
// test 2
_categories.Add(new Category() { CategoryName = "test" });
_db.SaveChanges();
Debug.WriteLine(_db.Categories.Count());
Debug.WriteLine(_db.Categories.Local.Count());
Debug.WriteLine(_categories.Count());
The test 1 shows 6 rows in the database, and 0 in local.
The test 2 shows 7 rows in the database, and 1 in local (both versions)
I also atempted to use _db.Category.Load() but as expected, it doesn't work because it is db first, not code first.
I also went through this page https://msdn.microsoft.com/en-us/library/jj574514(v=vs.113).aspx, created an object-based data source and linked my combo box to it, without success.
Does anyone know what I am doing wrong?
Thank you in advance for your help.
The DbSet<T> class is IQueryable<T>, hence DbSet<T>.Count() method maps to Queryable.Count<T> extension method, which in turn is translated to SQL query and returns the count of the records in the database table without loading anything into db context local cache.
While DbSet<T>.Local simply gives you access to the local cache. It contains the entities that you added as well as the ones being loaded by query that returns T instances (or other entities referencing T via navigation property). In order to fully load (populate) the local cache, you need to call Load:
_db.Categories.Load();
The Load is a custom extension method defined in QueryableExtensions class, so you need to include
using System.Data.Entity;
in order to get access to it (as well as to typed Include, XyzAsync and many other EF extension methods). The Load method is equivalent of ToList but without overhead of creating additional list.
Once you do that, the binding will work. Please note that the Local will not reflect changes made to the database through different DbContext instances or different applications/users.
I am Facing problem with Lov, I am having three lov fields in the page which are defined on other viewObjects than current page viewObject. iam successfully able to bind them to the page i.e getting values by clicking the icon.
but the problem is while executing i am not getting any values for these fields, i tried to override createInstanceFromResultSet() method in viewImpl class where iam getting ids and setting values, for example by using appid in current row of Vo, iam setting appName, with out success. iam very new to ADF, any solutions. my jdevelper version is oracle 11g release2
Actually my functionality is similar to POST-QUERY trigger in oracle forms, where you set the values based on id.
Anybody has any guesses please share.
The Best way i found out is From "Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework Release1 is To have your View object based on multiple Entity Objects, joining in all the information you need in the query from the main table, as well as any auxiliary/lookup-value tables. so in one trip you can bring all the values from the database.
I believe the way that you did bind these LOVs are wrong, follow this blog post https://blogs.oracle.com/prajkumar/entry/create_lov_in_adf_application it'll give you a heads up about the proper way to make LOVs
If you can't get LOV value after execution in ADF, then please check both data types you defined on ViewObject and to those fields, apply Lov. If the data type of both the fields is different, then the submitted value is refresh and Lov field is showing blank.
I notice many CakePHP data source authors create the method to always return true. Is this so that you can ask the data source if it is connected ( like in a MySQL or Oracle db) or does the CakePHP data source itself call that function at some point?
there is a connected property in DBO_* but no methods like is_connected. you can also find a connect() method in the DBO files.
The connect will be called when the model is called as that will call the datasource. The reason most datasources will just return true is that they do not connect to anything. If might just be a file (csv datasource etc)
How to get the details of the deleted objects from Active directory using LDAP.
The deleted objects are stored in the separate container, to retrieve the objects have the look on this technet site.
It is the inbuilt feature and should have the operating system of Windows Server 2008 or higher.
*This answer comes from Rodney Anderson, contractor who sits next to me and happens to know AD quite well. He says email him with any questions you have (link provided)
Use dsquery.
http://support.microsoft.com/kb/258310 (LDAP Query)
...the other method is a DSquery from the command line using the following command you should be able to retrieve most attributes which remain in the tombstone (everything in one line): Just keep in mind that this query will not necessarily return all attributes which are preserved in a tombstone - some critical objects and changes of the list are hardcoded and will remain in the tombstone no matter what the searchflags state. This is the solution I used and it will take some tweaking for their domain.
dsquery * cn=schema,cn=configuration,dc=yourcomain,dc=com
-filter "(&(objectClass=AttributeSchema)(searchFlags:1.2.840.113556.1.4.803:=8))"
-scope subtree -attr name
On MSDN there is a nice article on finding tombstone objects in Active Directory using the .NET framework DirectorySearcher class.
Well unfortunately there isn't all that much data available from a deleted object. Only about enough data is retained to be able to replicate the deletion to other DC's from my experience. You can get what is available through System.DriectoryServices. Some of this seems to have to do with security and not wanting people to root around looking at old items.
To get the details of Deleted objects from active directory using LDAP server is before getting the details we should be aware of the administration limits.These administration limits are as such like InitRecvTimeout,MaxActiveQueries ,MaxConnections,MaxConnIdleTime,MaxPageSize,MaxPoolThreads,MaxQueryDuration,MaxValRange.
Once we get aware of the limits of the administration we should be able to Default the user setting.
After this go and view current policy setting...at the command prompt type LDAP setting press enter,then type in the connection and then once all the connection got displayed there and then see which all connection is not visible.This will make you known who all user are deleted at the LDAP.
You can use DirectorySearcher to list the Deleted objects with the Tombstone property set to true
using(DirectorySearcher srch = new DirectorySearcher(de))
{
//to return only deleted objects otherwise you can give any valid LDAP filter
srch.Filter = "isDeleted=TRUE";
// Instruct the DirectorySearcher to return deleted objects
srch.Tombstone = true;
srch.FindAll();
//...
}