Hi Manel,
To reply to your original question, you can follow these steps for installing Local Server and updating your WPF application NuGet reference. Be sure to choose v100.1.0. Either set install path (i.e. LocalServerEnvironment.InstallPath = @"C:\Program Files (x86)\ArcGIS SDKs") or enable SDE and other child packages in your AGSDeployment file.
You can use the following code to create EnterpriseGeodatabaseWorkspace. Be sure to replace with correct connection string or full ArcSDE file path.
var service = new LocalMapService(@"c:\Data\Sample.mpk");
service.SetDynamicWorkspaces(new DynamicWorkspace[]
{
EnterpriseGeodatabaseWorkspace.CreateFromConnectionString($"{Guid.NewGuid()}", "PASSWORD=password;SERVER=servername;INSTANCE=instancename;DBCLIENT=sqlserver;DB_CONNECTION_PROPERTIES=servername;DATABASE=databasename;USER=username;VERSION=dbo.DEFAULT;AUTHENTICATION_MODE=DBMS"),
EnterpriseGeodatabaseWorkspace.CreateFromConnectionFile($"{Guid.NewGuid()}", @"C:\Data\SampleConnection.sde")
});
await service.StartAsync();
MyMapView.Map.OperationalLayers.Add(new ArcGISMapImageLayer(service.Url));
You can retrieve workspace again using the following code.
var workspace = service.GetDynamicWorkspaces().FirstOrDefault(w => w is EnterpriseGeodatabaseWorkspace) as EnterpriseGeodatabaseWorkspace;
You can then create sublayer using this workspace. Be sure to replace with correct workspace name and apply the correct symbology (i.e. point features with marker symbols, line features with line symbols, polygon features with fill symbols, etc.).
layer.Sublayers.Clear();
layer.Sublayers.Add(new ArcGISMapImageSublayer(0, new TableSublayerSource(workspace.Id, "YourWorkspaceName"))
{
Renderer = new SimpleRenderer(new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, Colors.Blue, null))
});
This should work, can you give this a try?
As for your follow-up question, I am unclear about what you're trying to do with 3D symbol. Maybe try that you're able to load layers from mpk first. InvalidOperationException may be raised when edit is not enabled or table is not ready. To troubleshoot features not rendering, you can subscribe to LayerViewStateChanged of MapView/SceneView and check for layer view status (i.e. is it Active, OutOfScale, Error, NotVisible? Does layer.LoadError have a value?